Jump to content

Refresh on load


BreakBreak

Recommended Posts

[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).
Link to comment
https://forums.phpfreaks.com/topic/24489-refresh-on-load/#findComment-111811
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!
Link to comment
https://forums.phpfreaks.com/topic/24489-refresh-on-load/#findComment-111829
Share on other sites

Archived

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

×
×
  • Create New...

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.