Forcing IE to behave

If you're looking to make IE respond like all the other browsers when it comes to forced downloads, standard Content-type and Content-disposition headers won't do the trick. However, this PHP snippet shows what will. Be sure to modify the last Content-type header to whatever MIME type the file actually is. header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-ch

If you're looking to make IE respond like all the other browsers when it comes to forced downloads, standard Content-type and Content-disposition headers won't do the trick. However, this PHP snippet shows what will. Be sure to modify the last Content-type header to whatever MIME type the file actually is.

header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header("Content-Type: application/download");
header("Content-Type: a-xzip-compressed");
header("Content-disposition: attachment; filename=" . $name);

Recommended
Join the discussion
Be the first to comment on this article. Our Commenting Policies