View Full Version : Last modified information on web page
florida
11-27-2002, 03:22 PM
Please advise how I can get "Last modified on ......" on my web page.
I see web pages with:
Last modified on 11/27/2002 5:24:45
This tells me that the web page was last modified on 11/27/02 at 5:24:45 AM.
korkyhavoc
11-27-2002, 03:32 PM
Insert the following statement in your html code:
<script language="JavaScript">document.write("This page last updated on " + document.lastModified);</script>
All on the same line.
brothercake
11-27-2002, 03:35 PM
Check out http://www.brothercake.com/scripts/updated.php for some interesting formats :)
florida
11-27-2002, 04:18 PM
The below gives me current date and time in IE but not the last modification date of the html.
Also it prints "December 31,1969" in my Netscape 4.77 Browser.
Can you please advise more information on what I am doing wrong?
brothercake
11-27-2002, 04:58 PM
Nothing; ns4 is not y2k compliant, although there is supposed to be a patch available, I've never been able to find it. It just seems like luck - i have a 2k compliant version of 4.7, but I couldn't tell you how to patch a non compliant version.
BrainJar
11-27-2002, 10:47 PM
The below gives me current date and time in IE but not the last modification date of the html.
Also it prints "December 31,1969" in my Netscape 4.77 Browser.
The last modified date is sent by the web server as a response header, (much the same way that cookies are sent) which is optional. The results you're seeing usually mean that the web server did not send a last modified header with the file so the browser just displays a default date. In IE, it defaults to the current date. In Netscape 4 it defaults to a -1 value which translates to the day before the earliest date it can handle, 1/1/70.
whammy
11-28-2002, 12:01 AM
I'd probably replace that "last modified date" in NS 4.x with:
"Unfortunately, your browser is obsolete. Please visit [insert link here], and download a modern browser to improve your internet experience."
:)
realisis
11-28-2002, 04:50 AM
further to Brainjar's post, try this somewhere in the BODY of your document:
<!--#echo var="LAST_MODIFIED"-->
If your server supports SSI, the desired date will be printed wherever the directive was placed.
jalarie
12-03-2002, 03:08 PM
It's not Netscape that's giving you problems, it's your ISP.
The document.lastModified information is part of a group of items often used by hackers to get into web servers. Many ISP's simply block the entire group instead of going to the extra effort of blocking only those items that are actually a problem. The result is that the server gives a null value for these items.
Internet Explorer takes the null value, uses it as-is in the 'new Date()' function, and gets the current date and time. This makes many people believe that IE is returning valid information. It is not.
Netscape gets the same null value, forces it to be numeric, gets a zero at this step, uses the zero in the 'new Date()' function, and gets the first midnight of January 1, 1970, GMT. Here in the eastern U.S.A, this translates into 'December 31, 1969, 7:00pm.' Other timezones get other results.
WebTV works pretty much the same as Netscape, but does the timezone offset earlier, winds up with a negative value, and gets all upset about it.
Check out the bit of JavaScript coding at the bottom of any of my pages to see how I get around these problems. The site address is:
http://spruce.flint.umich.edu/~jalarie/
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.