Results 1 to 5 of 5

Thread: code to check website update

  1. #1
    Join Date
    Sep 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default code to check website update

    Hi all,
    I can't remeber what the code was to type in the address bar to check when any webpage you're viewing has been updated. If someone knows, could you refresh my memory? I used to use it all the time for particular web pages, and have forgotton what to type, not sure if it was javascript or html (http) before the address.

    Thanks.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    um...

    Code:
    javascript:alert(document.lastModified)
    Is that what you're looking for?
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    javascript:alert(document.lastModified)
    This will only get you the time stamp of the file on the server. Generally that is fairly accurate. But due to time variations on servers, as to what time zone they are set to and if their clock is accurate, I would tend to be most comfortable with the date reported (which also could be wildly in error in some rare cases), taking the precise time reported with a grain of salt.

    Now that is just in regard to hard coded pages like .html and .htm, it will usually not work at all well on server side generated pages like PHP or asp pages. You will get either the current date/time or Jan 1 1970 (the date that 'time began'* as far as javascript is concerned).


    *They have dinosaurs back then? You Think?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Sep 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks!

    That was exactly what I was looking for.

  5. #5
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry for the necro, but is there any way this can be utilized to where I can put it on a webpage and it checks for updates every X amount of seconds.

    I update my site frequently, and I would like people to receive an alert that says a custom message.

    I don't have any JS writing skills, but from what I know, this is how it could work:

    Sets date and time user accessed the page, and reaches for the last date modified(without displaying an alert). This will check the access date with the last date modified. If the modified date is more recent then the access date, it will then display the message to the user with the custom message.

    (Not sure if this works while the user is using a page)

    But I am looking for something that can do this, since I update pages a lot.

    ~GP Admin~

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
  •