Jump to content

IE will not display a pdf file


wowdezign

Recommended Posts

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

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");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.