wowdezign Posted March 20, 2010 Share Posted March 20, 2010 I have code that I inherited from another developer. The code is supposed to take a file with a generic extension (in this case .dat) and display it as a pdf or xls or whatever. Every browser I have tried displays this correctly except one... care to guess which one doesn't seem to respect the mime type? Well, just for those that haven't already figured it out, it's IE. This code pulls the file with the .dat extension and tells IE what it is via the response header. Does anyone know of a way to force this issue? Link to comment https://forums.phpfreaks.com/topic/195875-ie-will-not-display-a-pdf-file/ Share on other sites More sharing options...
dragon_sa Posted March 20, 2010 Share Posted March 20, 2010 You could try this at the top of your page, this resolved the issue for me generating xls files // IE fix to prevent crash load for xls spread sheet if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { session_cache_limiter("public"); } // Convert page to xls document header("Content-Type: application/vnd.ms-excel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("content-disposition: attachment;filename=file.xls"); Link to comment https://forums.phpfreaks.com/topic/195875-ie-will-not-display-a-pdf-file/#findComment-1029006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.