SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP interferes with Javascript lastModified function

    I have found a useful Javascript snippet at http://www.whytehouse.com/lastmodified.html which shows the date a page was last modified. I have put it at http://www.pfwd.co.uk/last-modified/...t-modified.htm where it works perfectly. But the same script with a PHP file extension as here http://www.pfwd.co.uk/last-modified/...t-modified.php only shows the current time. There is no PHP in the page, but somehow the PHP processor seems to be upsetting it. Can someone see a way round this please?

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that the server interprets the php file on the fly and sends the last modification date (==interpretation time) to the browser. That is the date/time javascript has access to.
    If you access a static html file with your browser, the server sends the last modification time of the file found in the filesystem to the browser.
    So with dynamic pages (php,jsp,asp,etc.) you should not rely on javascript but set the last modification on server side.
    --------------------------
    Karsten Rieger
    http://www.tritium-design.de

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fidel, thank you very much. That explains it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •