PHP header problems (Update)

I have code like:

header('Refresh: 15; url=' . $url); 

This works great unless people visit this URL via Twitter (posted by the Hootesuite client). Apparently, in all browsers except IE, this works correctly. With IE, from the Hootesuite link, this is not being updated properly; direct link.

Why?

0
php refresh header
source share
3 answers

It turns out that since the URL we use sets a cookie and Hootsuite creates a frame, this IE will not trust a third-party cookie (our site). So I added the framebaster code to the page and called it right away if the browser is IE. Code below:

 <meta http-equiv="refresh" content="15;url=<?php echo $url ?>" /> <script type="text/javascript"> var timeout = 1; if (navigator.userAgent.match(/MSIE/)) { timeout = 1; } else { timeout = 14500; } setTimeout('if (top != self) top.location.replace(self.location.href)', timeout); </script> 

Perhaps this will someday help some other casual users.

+1
source share

I always advocate a combination to avoid problems with the inevitable WebTV user:

  • Title (how you do it)
  • Meta tag (in the HTML header)
  • Javascript timeout

If a Twitter client uses link shortening, the type of redirection can affect IE in an unexpected way.

+2
source share

If you are tired, for example, assign a location header.

 $url = "http://www.example.com/"; header("Location: " . $url); 
0
source share

All Articles