Jump to content

Archived

This topic is now archived and is closed to further replies.

BreakBreak

Refresh on load

Recommended Posts

Is it possible to make a page refresh as soon as it's loaded (i.e green bar at bottom right stops loading)

This would help a lot with my loops that i don't want to end, thanks.

Share this post


Link to post
Share on other sites
infinite loop.
Or if you want a permanent refresh(totally pointless)
<?php
header('Location: page.php');
?>
it will redirect over to the same page over and over and over again, but there is absolutely no point, unless you wnat to piss people off.

Share this post


Link to post
Share on other sites
[quote author=businessman332211 link=topic=112064.msg454667#msg454667 date=1161293546]
infinite loop.
Or if you want a permanent refresh(totally pointless)
<?php
header('Location: page.php');
?>
it will redirect over to the same page over and over and over again, but there is absolutely no point, unless you wnat to piss people off.
[/quote]

that won't ever fully load, however. what he's asking for is to refresh the page [b]after[/b] a full page load. to do this, you'd want to use a javascript refresh. something like this should do the trick:
[code]
window.onload = function() {
  window.location.reload(true);
}
[/code]

remember that with the reload() function, the boolean value passed to it forces it to reload from the server (if it's false, it allows it to reload from cache).

Share this post


Link to post
Share on other sites
Does the on.load function work if the php terminates the page as it's been running too long?

Where would i put that function above?

Share this post


Link to post
Share on other sites
the function i showed above is a javascript function, so it's a client refresh. if your server times out because your script was running too long, it will simply die as with any other PHP error. as you asked in your initial post, this doesn't actually force the refresh until the page has [b]completed loading[/b], so while the script is running on the server, it will not refresh.

with that said, you'd simply place that code above within script tags in the head of your page like you would with any other javascript function.

good luck!

Share this post


Link to post
Share on other sites
Damn, i need it to refresh if the php times out.

What confuses me IMENSELY is that it SOMETIMES times out and other times is completley fine :!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.