find the date a web page was posted

Discussion in 'Windows Desktop Systems' started by Perris Calderon, Jan 5, 2003.

  1. Perris Calderon

    Perris Calderon Moderator Staff Member Political User

    Messages:
    12,332
    Location:
    new york
    you'll probably want to paste this somewhere you can get to it;

    javascript:alert(document.lastModified)

    paste that into the address bar of whatever page you're on, and the date the page was last edited pops up.

    not bad for fir finding out if there's new content before you spend too much time looking a website over
     
  2. 2z

    2z OSNN Gamer

    Messages:
    2,439
    Location:
    England
    he he he

    thats a neat little trick

    nice find dealer

    :cool:
     
  3. Bman

    Bman OSNN Veteran Original

    Messages:
    8,799
    Location:
    Ottawa, Ontario
    thats pretty cool dude, nice find!
     
  4. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    I would have to agree.
    Good one Perris. =)
     
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Doesn't work with mozilla :confused:
    Handy if you're an IE user tho :)
     
  6. Jewelzz

    Jewelzz OSNN Godlike Veteran

    Messages:
    10,977
    Location:
    California
    This is why you should use IE :p
     
  7. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Bleh. I'll live without knowing when a page was updated.
     
  8. dav3st

    dav3st OSNN Addict

    Messages:
    74
    ?? Works for my in mozilla, not in pages generated dinamically like this, but ie just shows the actual time useful if you don't have a clock :p
     
  9. yoyo

    yoyo _________________

    Messages:
    1,557
    In Mozilla it always tells me "Last modified january, 1st 1970". Doubt if this is true. ;)

    If you want more of these javascript tricks check this site: http://bookmarklets.com
     
  10. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Why?? That's the last time I modified my website. =)
     
  11. Kevin Ar18

    Kevin Ar18 OSNN Senior Addict

    Messages:
    300
    document.lastModified can only tell you when you downloaded that page from the server. In other words it tells you the date of the file in your cache/temporary internet folder.
    I you hit refresh and let you browser redownload that page, document.lastModified will change to that new date.

    (Client Side) Javascript cannot access the true date of when the file was modified on the server.
     
  12. Kevin Ar18

    Kevin Ar18 OSNN Senior Addict

    Messages:
    300
    Nevermind, it does work. One of the sites I tested it on must have had a quirk.
    BTW, It works in Mozilla version 1.3
     
  13. Kevin Ar18

    Kevin Ar18 OSNN Senior Addict

    Messages:
    300
    I was looking up info on the lastModified property and found this interesting tidbit of information:

    The lastModified property is derived from the HTTP header data sent by the web server. Servers generally obtain this date by examining the file's modification date.

    The last modified date is not a required portion of the header, and some servers do not supply it. If the server does not return the last modified information, JavaScript receives a 0, which it displays as January 1, 1970 GMT. The following code checks the date returned by lastModified and prints out a value that corresponds to unknown.

    http://developer.netscape.com/docs/manuals/js/client/jsref/document.htm#1193811
     
  14. Hipster Doofus

    Hipster Doofus Good grief Charlie Brown

    Messages:
    5,920
    Location:
    Melbourne Australia
    Very useful tip dealer. Gonna come in handy & help not waste so much time. :)

    yoyo that site you linked looks good too. Haven't had a look around yet though it was last modified on 6th September 2002. :cool: