Rajasekar Gunasekaran
Rajasekar Gunasekaran

Reputation: 1827

CSV file not open in IE

I have create a CSV file in my php code, after create CSV, I try to open the CSV using window.open(), this will work fine all browser except IE 7 and IE 8,

in IE a new window open then it close automatically

how to solve this problem,

Upvotes: 1

Views: 934

Answers (2)

Michael Mior
Michael Mior

Reputation: 28753

Try adding the following at the beginning of your script:

header('Content-Disposition:inline');

This should direct the browser to display the file instead of prompting a download, which may be the problem.

Upvotes: 1

NT3RP
NT3RP

Reputation: 15370

If I recall, Internet Explorer has a peculiar quirk when trying to open files, even if the proper MIME type is set in the header.

You may need to do the following to get the CSV to download:

  • Go to Tools > Internet Options
  • Select the Security tab, then press the Custom Level... button
  • Scroll down to the Downloads section, and under Automatic prompting for file downloads select Enable

Hopefully, that should resolve the issue.

Upvotes: 1

Related Questions