Current location: Hot Scripts Forums » General Web Coding » JavaScript » How do I have a page automatically refesh ONLY ONCE!


How do I have a page automatically refesh ONLY ONCE!

Reply
  #1 (permalink)  
Old 12-23-03, 03:53 AM
mysticonline mysticonline is offline
New Member
 
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy 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!!!
Reply With Quote
  #2 (permalink)  
Old 12-23-03, 04:46 AM
snaip's Avatar
snaip snaip is offline
iNET Interactive
 
Join Date: Nov 2003
Posts: 997
Thanks: 2
Thanked 7 Times in 6 Posts
You tried this:

Try this:

Place this at the top of your page:

Code:
<script language=" JavaScript" >
<!-- 
function LoadOnce() 
{ 
window.location.reload(); 
} 
//-->
</script>
Then change your <Body> to say;

Code:
<Body onLoad=" LoadOnce()" >
__________________
Regards,
Ahmad Permessur
Team HotScripts
Reply With Quote
  #3 (permalink)  
Old 12-23-03, 04:47 AM
snaip's Avatar
snaip snaip is offline
iNET Interactive
 
Join Date: Nov 2003
Posts: 997
Thanks: 2
Thanked 7 Times in 6 Posts
Also found this somewhere:

To refresh a page once each time it opens use: <META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1"> inbetween your <head></head> tags instead of relying on JS here.
__________________
Regards,
Ahmad Permessur
Team HotScripts
Reply With Quote
  #4 (permalink)  
Old 12-23-03, 04:49 AM
jonathen's Avatar
jonathen jonathen is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Essex, UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mysticonline
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!!!
Try this:

<script>
window.onload = function()
{
if (!window.location.search)
{
setTimeout("window.location+='?refreshed';", .1000);
}
}
</script>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Only allowing original referrer to access a page fixafone123 PHP 3 05-28-04 04:42 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
echo foriegn html in static page fergusom Everything Java 4 11-10-03 02:35 AM
Automatically loading page mpalmen PHP 5 09-02-03 07:40 PM
preload an asp page Gurrutello ASP 1 06-24-03 08:12 PM


All times are GMT -5. The time now is 11:38 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.