PDA

View Full Version : Refreshing page once when opened


wwwolf
01-01-2003, 02:35 PM
Does any one know if there is a code to refresh a page once, when it is opened: so not every 10 seconds or something, but just when it is opened, so that it won't open a previously cached version of the page.
Thanks!
Wolf

redhead
01-01-2003, 04:54 PM
one of x_goose_x's scripts:<script language="Javascript">
if (location.search!="?") { // to make it refresh more or less then add/remove question marks
setTimeout("window.location.replace(location.href+'?')",3000); // 3000 = 3 seconds
}
</script>


:thumbsup:

wwwolf
01-01-2003, 05:23 PM
Thanks for the suggestion, but this doesn't seem to work: it seems to retrieve the last cached page, even when that isn't the most recent one page.

Maybe some background information helps, describing the situation (without including extra scripts):

I have a guestbook in CGI which is programmed by my provider. When people add an entry in the guestbook they come to a confirmation page and there they can click on "guestbook" to go back to see the guestbook... Their entry is not automatically shown (unless they click on the Refresh-button of the browser), since the browser uses the cache to present the guestbook. Therefore I am looking for a solution so that, when they go to the guestbook, they immediately see their own entry and know that it is there. (Otherwise they might try and enter a second entry, which isn't necessariy.) So I thought that including some kind of code to tell the page that every time it is opened, it has to refresh itself once...

I hope you understand what kind of thing I need. I hope someone else knows what I could do to solve this problem.

Take care,
wolf

redhead
01-01-2003, 05:46 PM
ok... if you make sure the page doesnt get cached when they first take a look at the guestbook then it should (in theory) get the latest version of that page...

heres some suggestions on how to make sure that the page doesnt get cached...

http://www.codingforums.com/showthread.php?&threadid=12193

jalarie
01-03-2003, 05:47 PM
Check out the "Samples of my work > Guaranteed Fresh" page for another way:

&nbsp;http://spruce.flint.umich.edu/~jalarie/