且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

禁用 Chrome 严格的 MIME 类型检查

更新时间:2021-11-08 22:15:22

服务器应该以正确的 MIME 类型来响应 JSONP application/javascript 并且你的请求应该告诉 jQuery 你正在加载 JSONP 数据类型:'jsonp'

The server should respond with the correct MIME Type for JSONP application/javascript and your request should tell jQuery you are loading JSONP dataType: 'jsonp'

请参阅这个答案 了解更多详情!你也可以看看这个,因为它解释了为什么用.js文件code>text/plain 不起作用.

Please see this answer for further details ! You can also have a look a this one as it explains why loading .js file with text/plain won't work.