- October 18, 2010
- Categories: Internet Explorer, PHP
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /homepages/24/d152177141/htdocs/techblog.tonycollings.com/wp-content/plugins/code-highlighter/geshi.php on line 2147
Huh! This is an interesting dilemma I came across today. Take some fairly standard PHP export script:
span style="color: #ff0000;">"Content-type: application/vnd.ms-excel""Content-Disposition: attachment; filename=some-filename.xls");
... set some headers and print($sMyCSVFile);
. Well NOT so much with Internet Explorer. Works perfectly with everything else.
Turns out that there is a known issue opening documents over SSL with Internet Explorer. (MSDN Article: 316431) and it's all to-do with caching! If EITHER of the following headers exist then the script will fail:
The answer; it turns out, is relatively easy. Simply set :
.. Voila! There are also some nice examples of forcing file-download on php.net (http://us3.php.net/manual/en/function.readfile.php)
Further Reading:
- W3C HTTP1.1 Header Standards http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html