Forum Moderators: coopster

Message Too Old, No Replies

Questions About PHP Refresh

php refresh

         

Tehuti

5:25 am on Nov 12, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



I am using a PHP refresh to redirect visitors to another site after a short delay. I've put the code at the very top of my document, above the doctype. The code looks like this:

<?php
header("refresh: 10; url=some_url");
?>

As you can see, it's set to refresh after 10 seconds.

Questions:

1) Does it refresh 10 seconds after the whole page has downloaded, including all images, or 10 seconds after the HTTP request has been sent to the server?

2) Are PHP refreshes more reliable and compatible than meta refreshes? Which would you use if you had to do a refresh?

bkeep

2:07 am on Nov 13, 2009 (gmt 0)

10+ Year Member



1) I am not 100% sure but I would imagine the ten seconds starts when the client receives the header, regardless of how much has been downloaded but I don't know for sure.

2) I don't think there is a difference between a PHP refresh and a standard meta refresh other than syntax.

These would all be functionally the same.

<?php
header("refresh: 10; url=some_url");
?>

<?php
echo '<META http-equiv="refresh" content="10"; http://example.com/somepage.html>';
?>

Or just place this in the head section of your HTML document.
<META http-equiv="refresh" content="10"; http://example.com/somepage.html>

As far as What I would do about refreshing a page it depends on the situation. From your example

I am using a PHP refresh to redirect visitors to another site after a short delay

Are you wanting to forward for an entire site or after a brief delay after signing up or something similar?