[英]How to address error "Did not load script at 'script name' because non script MIME types are not allowed when 'X-Content-Type: nosniff' is given
I have a fairly simple Angular 1.x app that was working fine until i upgraded to Safari 11. Now, it doesn't work because almost all of the js files are blocked. 我有一个相当简单的Angular 1.x应用程序工作正常,直到我升级到Safari 11.现在,它不起作用,因为几乎所有的js文件都被阻止。
The same was true for CSS files, but removing the "rel" attribute and adding type="text/css" fixed the CSS issues. CSS文件也是如此,但删除“rel”属性并添加type =“text / css”修复了CSS问题。
For the JS files, I've made sure to add type="text/javascript" to the script tags. 对于JS文件,我确保在脚本标记中添加type =“text / javascript”。 I also just tried adding ./ to the beginning of the src's for giggles and they still won't load.
我也尝试将./添加到src的开头为giggles而且仍然无法加载。
Does anyone know how to fix this? 有谁知道如何解决这一问题?
Thanks, Wayne 谢谢,韦恩
I want to just delete the question but I hope maybe this answer will still be helpful to someone. 我想删除这个问题,但我希望这个答案对某人有用。
So, my problem was actually that I had a bad clone of my project and it was missing files! 所以,我的问题实际上是我的项目有一个糟糕的克隆,它丢失了文件!
However, for anyone having the same issue: 但是,对于有同样问题的人:
ensuring that type="text/css" for stylesheets and type="text/javascript" did fix the issue. 确保样式表的type =“text / css”和type =“text / javascript”确实解决了问题。 (for the files that actually existed)
(对于实际存在的文件)
Please make sure that a response header with the name X-Content-Type
or X-Content-Type-Optionas
has the text/javascript
value instead of nosniff
. 请确保名称为
X-Content-Type
或X-Content-Type-Optionas
的响应标头具有text/javascript
值而不是nosniff
。
It is simple to make a workaround locally using Charles Proxy Rewrite tool 使用Charles Proxy Rewrite工具在本地进行解决方法很简单
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.