最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to address error "Did not load script at 'script name' because non script MIME types a

programmeradmin1浏览0评论

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.

The same was true for CSS files, but removing the "rel" attribute and adding type="text/css" fixed the CSS issues.

For the JS files, I've made sure to add type="text/javascript" to the script tags. I also just tried adding ./ to the beginning of the src's for giggles and they still won't load.

Does anyone know how to fix this?

Thanks, Wayne

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.

The same was true for CSS files, but removing the "rel" attribute and adding type="text/css" fixed the CSS issues.

For the JS files, I've made sure to add type="text/javascript" to the script tags. I also just tried adding ./ to the beginning of the src's for giggles and they still won't load.

Does anyone know how to fix this?

Thanks, Wayne

Share Improve this question asked Nov 14, 2017 at 14:32 Wayne KaskieWayne Kaskie 3,4835 gold badges35 silver badges50 bronze badges 3
  • Is the server not setting the correct types? – epascarello Commented Nov 14, 2017 at 14:34
  • I'm testing the app locally using nam live-server. It's worked fine until Safari update – Wayne Kaskie Commented Nov 14, 2017 at 14:47
  • I just noticed a typo in my prior comment. I meant npm live-sever. – Wayne Kaskie Commented Jul 25, 2018 at 13:57
Add a comment  | 

2 Answers 2

Reset to default 16

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. (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.

It is simple to make a workaround locally using Charles Proxy Rewrite tool

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论