PDA

View Full Version : code to check website update



bleuscreen
11-12-2007, 08:12 PM
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.

thetestingsite
11-12-2007, 08:22 PM
um...



javascript:alert(document.lastModified)


Is that what you're looking for?

jscheuer1
11-12-2007, 08:31 PM
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? :)

bleuscreen
02-06-2008, 08:03 PM
That was exactly what I was looking for.

GamingProject
07-17-2009, 05:56 AM
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~