Stop IE8 from opening or downloading a text/plain MIME type

感情迁移 提交于 2019-12-03 21:29:51

Add this to your HTTP header:

X-Content-Type-Options: nosniff

It's an IE8 feature to opt-out of its MIME-sniffing.

Source

Alternatively, you can "trick" IE8 into thinking that it is indeed serving up a text file. These 2 lines do it for me and don't involve using non-standardized "X-" headers:

Header("Content-Type: text/plain");
Header("Content-Disposition: inline; filename=\"whatever.txt\"");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!