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 win开发者_Python百科dow open then it close automatically
how to solve this problem,
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
Securitytab, then press theCustom Level...button - Scroll down to the
Downloadssection, and underAutomatic prompting for file downloadsselectEnable
Hopefully, that should resolve the issue.
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.
加载中,请稍侯......
精彩评论