PDA

View Full Version : Getting correct document.lastModified date


JimSwanson
05-30-2009, 06:03 PM
I've been having a problem with getting a correct "document.lastModified" date on a web page. My javascript always returns the date/time that I last viewed the page.

It struck me that since I am using some server-side includes in this page, the page will always be reported as modified when it opens (or very shortly thereafter ;)). Is this likely? If that's my problem, is there a way to solve it??

Any help appreciated!!

Jim Swanson

rnd me
05-31-2009, 08:35 AM
document.lastModified, a firefox property, is set by the server, there's nothing you can do to change it in javascript.

you could use ajax to run a head request on the url to check the "Last-Modified" header on the un-rendered file.