Displaying the last modified date of a web page using Javascript is just a matter of diplaying the document.lastModified property of Javascript.

document.lastModified;

In order for this property to work, the server has to send the information to the browser. which is widely supported by the browsers nowadays.

When a server does not send a lastModified date information to the browser, Netscape and Opera give a last modification date of 01/01/1970 at 00:00:00 hrs, while Internet Explorer gives today. So it is always a good practice to test the server if it is sending the necessary information to the browser before using this script.

document.lastModified


document.write(document.lastModified);

outputs: 18/01/2008 16:43:32

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!

Currently rated 4.5 by 4 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories : All | JavaScript | Tips
Share & Support : del.icio.us | DZone it! | Kick it! | digg it! | Furl | Technorati


Comments

October 22. 2009 17:35

Social comments and analytics for this post

This post was mentioned on Twitter by bloggingdev: How To: Display the Last Modified Date of a Document using Javascript - Javascript's document.lastModified Property - http://su.pr/7v0Scx

uberVU - social comments | Reply

Add comment




(Will not be displayed!)








SponsoredTweets referral badge
Free CMS