Correct headers for generating Excel over SSL

Internet Explorer cannot download page from site
Internet Explorer was not able to open this Internet site.
The requested site is either unavailable or cannot be found.
Please try again later

You message may look a bit different (esp. the page/site), but it’s likely you have a header issue. And if you can download the files in FireFox or another browser you might want to check the headers you are sending out before you tear apart your code looking for a bug that probably isn’t there.

I’ve found using these headers successful in all browsers over SSL.

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename={$type}.xls");
header("Pragma: public");
header("Expires: 0");

The code above is PHP-you may need to alter it according to your language syntax.

May they work for you as well.


Add Your Comment