![]() Equipping You to Communicate Effectively | support CMN & share a library of 19K+ images, videos, etc Go Pro! |
![]() | ![]() |
| |||||||
| Website Coding Discussions PHP, MySQL, Java, Javascript, ASP, etc. |
![]() |
| | Thread Tools | Search this Thread | Rate Thread | Display Modes |
| ||||
| Java "document.lastModified" not working??? This is wierd... I am using the following code snippet to show when a webpage was last updated.. BUT... Instead of showing when it was last modified, it shows the current date/time! I recently moved to a Godaddy shared host and added google analytics code. Before that, the code below worked fine. Anyone have any suggestions? Here is the website: http://www.arcluverne.org/news/home.html Code: var m = "Page last updated " + document.lastModified; var p = m.length-0; //can remove time by changing 0 to 8 document.write(m.substring(p, 0)); |
| ||||
| Well it turns out that the issue is that the server is not including the lastmodified information in the HTTP header. See this for an explanation: http://www.quirksmode.org/js/lastmod.html I will try to work with Godaddy on this, but I doubt they are going to budge as this is a shared hosting account. Any other suggestions on how I could accomplish the same thing? |
| ||||
| You can only safely accomplish this using a server-side solution, such as PHP, ASP, Server Side Includes, or any number of similar options. In PHP, this would look like: $modified = filemtime("filename"); echo "Modified on " . date("F dS Y - h:ia", $modified);
__________________ http://kanago.net - experiences in media |