The whole page become blank after redirecting with @header() in IE6
It's a login page. After validating, the user is redirected to home page:
@header("Content-type: text/html; charset=utf-8");
@header('Location: i开发者_Python百科ndex.php');
@header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
But the page becomes blank if IE6! How? And it happens only for the first time; afterwards it'll work normally!
Why are you suppressing the warnings/errors that might be happening? I'd say get rid of the @
first, and then tell us what is really going on.
header() won't work if there's any output already been sent. This includes spaces, empty lines or whatever. Make sure that there's strictly nothing being output before calling header.
Works:
<?php
header('Location: index.php');
?>
Does not work
<?php
header('Location: index.php');
?>
And remove the @, it eats up any useful info header tries to give you.
You can also redirect using javascript from client side:
Instead of :
@header('Location: index.php');
Client-side redirect:
echo "<script>document.location.replace('index.php');</script>";
I have been searching for an answer to a similar problem to yours for an hour or so. IE6 seems to have a problem with zipped content. Simply disabling mod_deflate on our server fixed the problem for IE6. Specifically version 6.0.29 appears to exhibit this bug.
Take a look at http://www.contentwithstyle.co.uk/content/moddeflate-and-ie6-bug
精彩评论