View Full Version : is it possible to auto refresh onload

11-26-2002, 03:04 PM
how can i make the viewer

load my latest updated index.htm

file on my site

and not the cashed one

so they have to refresh(f5)

is it possible and if so how?



11-27-2002, 01:58 PM
Virtually all browsers perform conditional GET requests, where the browser asks the server for the document, but only if modified since a certain date. Therefore, every page view should be getting the latest version of your document. Note that browsers may be configured to check documents for date only once per session (as opposed to every fetch request), so some users may not see the refreshed content. You can use

<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">

in your HTML to hint to the browser that it should not cache the page content, but that will force delivery of the full page every hit, which will mean higher server loads.

11-27-2002, 03:15 PM
Will the no cache tags do not work that great for most browsers! So there is a way to do it with javascript!

Look at this page and it will say what you need to do.



11-28-2002, 02:14 AM
This is set for half a second...Use 1000 for one sec, 5000 for 5 seconds, etc.

window.onload = function() {
if (!window.location.search) {
setTimeout("window.location+='?refreshed';", .5);
</script> :D

11-29-2002, 12:39 PM
META no-cache tags are no use; not only are they not universally understood, but they are not read at all by proxy-servers, which means a proxy can still cache the page.

Zoobie's js method looks good; you can also do it with PHP by sending out these headers before the <html> tag:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

11-29-2002, 01:59 PM
i have no say on on the sitebeing loaded

al i want is for my link to load the latest version on my clients

anyone got any other ideas

11-29-2002, 06:36 PM
try this http://www10.brinkster.com/a1ien51/Scripts/nocachelinks.htm

11-29-2002, 08:13 PM
You can lead a horse to water...

05-21-2003, 02:13 AM
how do you make your script work with a form button instead of a text link?

05-21-2003, 02:57 AM
<input type="button" onclick="NewSession('http://www10.brinkster.com/A1ien51',2)" value="HMM">


05-21-2003, 06:17 PM
thanks. does the bit below look correct, to you then?

<input name="submitc" type="submit" id="submitc" onClick="MM_openBrWindow, NewSession('5.htm','table486');javascript:self.close();" value="SUBMIT" />