• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

find the date a web page was posted

Perris Calderon

Moderator
Staff member
Political User
#1
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
 

dav3st

OSNN Addict
#8
?? 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
 

Kevin Ar18

OSNN Senior Addict
#11
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.
 

Kevin Ar18

OSNN Senior Addict
#12
Originally posted by Kevin Ar18
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.
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
 

Kevin Ar18

OSNN Senior Addict
#13
Originally posted by yoyo
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
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
 

Hipster Doofus

Good grief Charlie Brown
#14
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:
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies