English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I put this code on webpages to show when I last changed (modifytext) that page. But it does not work right. It lists present time or another recent time even if it is days since I changed it. Is it just my old computer or is this code no longer good. See page below-- view source where text ends and links begin (Copyright 2006....)

http://www.phifoundation.org/teen.html

2007-01-19 10:55:16 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

As the link below discusses, JavaScript works on the client side (the visitor's Web browser), not the server side (the Web server). Therefore, JavaScript relies upon the server sending a proper last modified header for the lastModified property to work. That hardly ever happens.

So, in short, you can't use JavaScript to reliably give you the page last modified time. It almost never works.

You can, however, use a server side include (SSI). The link below explains how.

The source link is a working demo displaying the difference between JavaScript's lastModified property and SSI's last modified directive.

http://answers.yahoo.com/question/index?qid=20061222042553AAzhYBV

2007-01-19 19:04:33 · answer #1 · answered by Anonymous · 0 1

This javascript is incorrectly used.
Web pages are downloaded to the user end computer and registered as most recent (current date) unless you visit the same page days later and no update was done on it then it will show the date it was last downloaded to teh user computer, but not when the page was really created or recently changed. The only way to really do this is with a server side script that embed the date into the HTML as part of it.
Learn more about server side scripts such as PHP, Perl, ASP, and more w3schools.com

2007-01-19 22:31:15 · answer #2 · answered by ◄|| G ||► 6 · 0 0



does it pretty well... it gets the date from the time the page is served from the server. Did you try it on a real server or just local? use a real server.

2007-01-19 20:07:49 · answer #3 · answered by jake cigar™ is retired 7 · 0 0

fedest.com, questions and answers