Refresh page on entry
Hi everyone,
Does anyone know how I can get my page to refresh only once when a visitor first visits it?
Right now I'm using:
But I want it just to refresh on entry.
I've got "the word of the day" on my page but it always gets stuck in the cache.
My page: http://www.bahamaswriter.com/
Any help would be much appreciated.
Thanks,
Gavin
Suzanne posted this at 16:39 — 3rd January 2002.
She has: 5,507 posts
Joined: Feb 2000
Use JavaScript -- set a variable, and increment the variable when the page loads the second time. test to see if the variable is 0 or 1, if 0 (first load), then reload. If 1, then do nothing.
Suzanne
gavin681 posted this at 20:17 — 3rd January 2002.
They have: 184 posts
Joined: May 2001
Tried that but it just kept reloading the page every second.
::Gavin
Suzanne posted this at 00:52 — 4th January 2002.
She has: 5,507 posts
Joined: Feb 2000
you tried using JavaScript?
If it's reloading every second, you aren't testing for the variable.
Suzanne
Suzanne posted this at 00:53 — 4th January 2002.
She has: 5,507 posts
Joined: Feb 2000
you can also use PHP, or fix whatever the problem is with the piece that doesn't load.
Netscape has an issue with CSS, so in the Netscape forums (netscape.com -- the developer forums), you can find refresh scripts (javascript) that will reload the page just once to fix the CSS problem.
Suzanne
gavin681 posted this at 20:50 — 6th January 2002.
They have: 184 posts
Joined: May 2001
Thanks Suzanne,
I have set it at "60" and seems to be working ok.
::Gavin
Kimberly posted this at 00:36 — 24th January 2002.
They have: 9 posts
Joined: Dec 2001
Where can I find a javascript code that makes the page refresh just once. All the ones I found are to refresh and send to another page.
Thank you for any help you could give me on this
Kimberly
gavin681 posted this at 16:04 — 24th January 2002.
They have: 184 posts
Joined: May 2001
>>Where can I find a javascript code that makes the page refresh just once.<<
Yeah. That seem to be the million dollar question.
It must be able to be done.
Gavin
Gavin Knowles
[email protected]
[=CC,00,00]Click Here to Get Your Free Webmaster ToolChest![/]
Jack Michaelson posted this at 21:00 — 24th January 2002.
He has: 1,733 posts
Joined: Dec 1999
I found this link:
http://developer.irt.org/script/973.htm
It works only with frames,
tried to get it to work without frames... but did not succeed (yet)
Hope it helps a bit,
Shakespeare: onclick || !(onclick)
gavin681 posted this at 21:58 — 24th January 2002.
They have: 184 posts
Joined: May 2001
OK I figured it out here is the code:
Using the complete URL forces the page to reload from the server and not the cache.
This code reloads the page only once!
Gavin
Gavin Knowles
[email protected]
[=CC,00,00]Click Here to Get Your Free Webmaster ToolChest![/]
gavin681 posted this at 22:22 — 24th January 2002.
They have: 184 posts
Joined: May 2001
I don't know it was working but every time I closed the browser and reopened in it stopped reloading only once.
We will have to keep searching for the right code to do this.
Gavin
Gavin Knowles
[email protected]
[=CC,00,00]Click Here to Get Your Free Webmaster ToolChest![/]
gavin681 posted this at 22:47 — 24th January 2002.
They have: 184 posts
Joined: May 2001
OK looks like the only way to do this is to make two of the same page (add a mirror page).
Add this code to the original page (replace my url with your mirror page url:
<script LANGUAGE="JavaScript1.1">
</script>
Gavin
Gavin Knowles
[email protected]
[=CC,00,00]Click Here to Get Your Free Webmaster ToolChest![/]
Suzanne posted this at 01:08 — 25th January 2002.
She has: 5,507 posts
Joined: Feb 2000
okay, look, there is a fix for the Netscape onresize error. I'll track it down, because it should work.
However, you really need to look at why you want to refresh the page. It would be far better to prevent caching if the content must be updated frequently, than to force a refresh.
I'll see if I can find it, back later,
Suzanne
gavin681 posted this at 00:04 — 29th January 2002.
They have: 184 posts
Joined: May 2001
Will this work?
<script language="Javascript"
src="http://www.dictionary.com/wordoftheday/wotd.js"></script>
.::Gavin
detox posted this at 00:56 — 29th January 2002.
They have: 571 posts
Joined: Feb 2001
This is adapted from a script on IRT, plasce this in the head of you document
<?php
<script language=\"JavaScript\"><!--
var Passed = '' + location.search;
if (Passed != '' && Passed != 'undefined')
Passed = parseInt(Passed.substring(1));
else
Passed = 1;
//document.write(\"this page has been refreshed\");
function loopy() {
loc = window.location.href
sPos = loc.indexOf('?');
if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search
window.location = loc + (Passed-1);
}
//--></script>
?>
and place this in your body tag
<?php
onLoad=\"setTimeout('loopy()',10000)\"
?>
this was meant to be a script to refresh the page 3 times I simply changed the variable Passed to 1
Jack Michaelson posted this at 08:16 — 29th January 2002.
He has: 1,733 posts
Joined: Dec 1999
That's a great script detox!
detox posted this at 11:50 — 29th January 2002.
They have: 571 posts
Joined: Feb 2001
Isn't that always the way, the best scripts are never your own!!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.