Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web page date? 3

Status
Not open for further replies.

MotorCity

Structural
Dec 29, 2003
1,787
0
0
US
Is there any way to determine the date that a web page was last revised? I tried contacting the web page owner without success. I want to verify if the information provided is current. Any suggestions?
 
Replies continue below

Recommended for you

Add this to the body
Code:
<script language="Javascript">
<!--
var lastmod=new Date(document.lastModified);
document.write("<i>Last Modified: " + lastmod.toGMTString().slice(4,16) + "</i>");
//-->
</script>
If you leave out the slice, you will also get the time, day and other bits.
 
Thanks xwb!

I'm not familiar with HTML code so I'm not sure if I added it correctly. I viewed the source and pasted the code you provided into the source code. I was unable to see when the page was last revised. Where will this information appear? Does it make a difference where I insert the information you provided?

If I want to see the revision date, do I only leave "slice" out?

Thanks for your help.
 
This is what it will look like: just copy it into a file and look at it in your browser. If you leave slice out, you will get everything including the time.
Code:
<html>
<head><title>From Eng-Tips</title></head>
<body>
The stuff before<br>
<script language="Javascript">
<!--
var lastmod=new Date(document.lastModified);
document.write("<i>Last Modified: " + lastmod.toGMTString().slice(4,16) + "</i><br>");
//-->
</script>
The stuff after<br>
</body>
</html>
 
Motorcity, the script xwb gave you has to be added by the webpage owner and then only AFTER the script has been added, will show the last revised date.

The only way to find out when it was revised (unless it shows in on the source already) is to contact the webpage owner. Sorry.

Chris

 
Hi, its possibly a bit late to resurrect this post, but assuming that the page you want to find ends in .html or .htm and not .php or anything else, thne you can type this in the address bar and press enter:

javascript:alert(document.lastModified)

This will pop-up a little dialog box showing the date and time of the last update. This wont work for dynamically created pages like php scripts, as it will just give the time that the page finished downloading to your browser.

Hope this was of some help and wasn't too late!
 
Status
Not open for further replies.
Back
Top