/    Sign up×
Community /Pin to ProfileBookmark

How do I have a page automatically refesh ONLY ONCE!

I’ve searched high and low and am unable to find any scripts or instructions on how to have a page automatically refresh ONLY ONCE after initially being loaded/viewed (as per whatever time variable/delay is set). I’ve found forwarding scripts/jumpers (which is not what I need) and scripts that repeatedly reload the same page automatically, in a loop, after a delay (eg: for random banner display). That doesn’t work for me either. All I want is for the SAME page to ONLY refresh ONCE (after a few seconds as per configurable time delay) after initially being loaded/viewed and then STOP! After that, I don’t want it to automatically refresh again unless the surfer leaves and views another page, and then returns to view this page again. At that point, it should do another SINGLE automatic refresh. Only refresh ONCE upon entry (ALWAYS),… not upon exit or repeatedly during viewing. I don’t want it to be stuck in a perpetual “loop”! Is there any way to accomplish this? HELP!!!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryDec 23.2003 — This may do what you want:
<script type="text/javascript">
// Number of milliseconds to wait before reloading
refreshTime = 2000;

if (location.search != '?refreshed'){ setTimeout('location.search = "?refreshed"', refreshTime); }
</script>
Adam
Copy linkTweet thisAlerts:
@mysticonlineauthorDec 23.2003 — Adam - Thanks a lot. the script works like a charm but, unfortunatley, didn't fix my problem. I donwloaded & am using the HV Menu from dynnamicdrive.com : http://www.dynamicdrive.com/dynamicindex1/hvmenu/index.htm and implemeted it on our webpage : http://www.mysticonline.com/demo2/index.htm The problem is that when the page is 1st loaded, the drop-down menu doesn't show up. But, if you manually refresh, it does. If you click on the "Design" or "Print" links in the top frame, you'll see what I mean. The resulting page is the only page with the refresh script you supllied embedded, but even after it automatically refreshed in 2 seconds, it still isn't showing the menu. You actually have wait for the entire page to load & then manually click refresh for it to show. Why is that? You can also try some of the other pages (which don't have the refresh script embedded) and see the same thing happen. Not all link are complete, but quite a few are in the Design/Print section. The web section does not utilize the menu, so don't expect it to appear. Since I wasn't able to circumvent the problem with your script, maybe you can suggest an actual fix! Thankx.
Copy linkTweet thisAlerts:
@AdamGundryDec 23.2003 — Interesting. Refreshing either the top frame or the bottom frame does not cause the menu to appear, you need to refresh the whole frameset to do so

I'm afraid I can't find anything immediately obvious wrong with your script, apart from possibly one section, this part of exmplmenu_var.js:

var FirstLineFrame='navig'; // Frame where first level appears

var SecLineFrame='space'; // Frame where sub levels appear

var DocTargetFrame='space'; // Frame where target documents appear

These lines appear to be referring to frames which do not exist; perhaps this could be your problem.

Alternatively, You might be able to rewrite the workaround like this, which hopefully will solve the problem:

<script type="text/javascript">
// Number of milliseconds to wait before reloading
refreshTime = 2000;

if ([b]top[/b].location.search != '?refreshed'){ setTimeout('[b]top[/b].location.search = "?refreshed"', refreshTime); }
</script>

Other than that, all I can suggest is contact the original author of the script. It is very complex, and it is possible there is a bug in the script itself.

Adam
Copy linkTweet thisAlerts:
@mysticonlineauthorDec 23.2003 — As you suggested, I contacted the developer, and this was their response: "When the script is used on a single page. (or on one frame) the frame variables FirstLineFrame, SecLineFrame and DocTargetFrame should be "". This falls right in line w/ what you had also mentioned about referring to frames which don't exist. I made this correction and everyhting seems to be working fine (for the moment). Thanks for all your help!
Copy linkTweet thisAlerts:
@AdamGundryDec 26.2003 — No problem. Happy Christmas. ?

Adam
×

Success!

Help @mysticonline spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...