Problem with HTML/PHP script in IE
I have a page where I want to display a form if the user clicked the url for that page, and well... This script below works totally fine in Firefox and Opera, but Internet Explorer (6 in my case) just shows a blank page. Although, when I refresh after visiting the page, it shows up fine. Deleting cookies etc from the browser doesn't solve anything..
<?php session_start(); ?>
doctype, htmltag, headtag etc etc...
<?php if($_GET['d开发者_运维百科o'] == 'whatever') { ?>
Content for ?do=whatever...
End htmltag etc etc...
<?php exit; } // Then end the script, because we don't want to display more content for ?do=whatever ?>
...Content to display if no action was set...
I also noticed that once I removed session_start(); from the script, it worked fine in IE. Any help is appreciated!
Try removing the Content-Type and Content-Language (if you use it) meta tags from the HTML, and put them directly in your PHP before or after the session start.
header('Content-Type: text/html; charset=UTF-8');
header('Content-Language: en-us');
I realize this doesn't look like it makes a lot of sense, but then again IE rarely makes much sense :)
I remember using it in a similar situation a while ago, involving gzip encrypted requests, using PHP sessions, being shown blank in IE6. The same solution may apply here. I never found out why it had worked, but it worked.
精彩评论