Results 1 to 12 of 12

Thread: cool Javascript

  1. #1

    cool Javascript

    cool Javascript that can tell u the last modied time of a page .htm page on anyones site

    cut and paste this code into the url when u are a .htm page

    javascript:alert(document.lastModified)

    or bookmark that code or make it a link on the tool bar or something

  2. #2
    interesting. thanks

  3. #3
    That isn't a bad script. But it doesn't seem very complicated

  4. #4
    Join Date
    Dec 2006
    Location
    Halifax, NS, Canada
    Posts
    4
    Quote Originally Posted by Ranky
    That isn't a bad script. But it doesn't seem very complicated
    Sometimes that is best.

    K.I.S.S.

  5. #5
    I just keep getting the 'current' date/time... How do I use this again??

  6. #6
    Join Date
    Mar 2006
    Location
    tikkabilla
    Posts
    51
    Quote Originally Posted by adpyramid
    I just keep getting the 'current' date/time...
    so do i, and i tried it on an old page that i know hasnt been updated
    http://parked.net -100% Google Adsense Revenue | http://viphotels.co.uk - Worldwide VIP Hotels

  7. #7
    Join Date
    May 2005
    Location
    Planet Earth
    Posts
    813
    This is not what I call a cool javascript..

    try :

    document.write("Cool Javascript");

    this is one

    G
    PutFile.io — Disrupting traditional file hosting.
    █ Signup Early and enjoy Unlimited space/bandwidth for your files hosting, Forever!
    █ No Ads.
    █ No Countdowns.

  8. #8
    If you put javascript:alert(document.lastModified) on a page or even on a old page it will return todays date. Because you are modifing by putting that in there???
    SlepeHost provides excellent hosting at excellent prices.
    We are dedicated to providing top quality hosting to a UK and Global market.
    http://www.slepehost.co.uk/
    For any information please contact support@slepehost.co.uk.

  9. #9
    Join Date
    Nov 2010
    Posts
    620
    With JavaScript, which is client-side in this case, you can't detect something server-side without having the server send that information. It will only show the last modified date if it was sent as a Last-Modified header by the server. If the header isn't sent, it wil show the current client's date and time.

    Very old topic by the way.

  10. #10
    then can anyone suggest something else
    a new JS code or in php

  11. #11
    Quote Originally Posted by bizwhiz View Post
    then can anyone suggest something else
    a new JS code or in php
    It isn't possible from a client's perspective. What happens when you paste this into your address bar is your browser is making an alert with the date and time that the header said the page was last edited on. With PHP, the underlying HTTP server will instead send the current date and time because the page is dynamically being created.

    If you go to a static page which is hosted on a web server that sends the last modified date & time in the header, then you will get the correct time it was last modified.

    For example, go to https://projects.csail.mit.edu/area2/public/ and try it out- it will work fine.

  12. #12
    Great - exactly what I've been looking for!

Posting Permissions

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