Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)

后端 未结 14 822
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 11:53

I am developing a web page using JavaScript and HTML, everything was working good when I have received this list of errors from my HTML page:



        
相关标签:
14条回答
  • 2020-12-13 12:11

    Check if the file path is correct and the file exists - in my case that was the issue - as I fixed it, the error disappeared

    0 讨论(0)
  • 2020-12-13 12:13

    It might be a wrong path. Ensure in your main app file you have:

    app.use(express.static(path.join(__dirname,"public")));
    

    Example link to your css as:

    <link href="/css/clean-blog.min.css" rel="stylesheet">
    

    similar for link to js files:

    <script src="/js/clean-blog.min.js"></script>
    
    0 讨论(0)
  • 2020-12-13 12:13

    https://cdn.rawgit.com is shutting down. Thus, one of the alternate options can be used. JSDeliver is a free cdn that can be used.

    // load any GitHub release, commit, or branch

    // note: we recommend using npm for projects that support it

    https://cdn.jsdelivr.net/gh/user/repo@version/file

    // load jQuery v3.2.1

    https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/dist/jquery.min.js

    // use a version range instead of a specific version

    https://cdn.jsdelivr.net/gh/jquery/jquery@3.2/dist/jquery.min.js

    https://cdn.jsdelivr.net/gh/jquery/jquery@3/dist/jquery.min.js

    // omit the version completely to get the latest one

    // you should NOT use this in production

    https://cdn.jsdelivr.net/gh/jquery/jquery/dist/jquery.min.js

    // add ".min" to any JS/CSS file to get a minified version

    // if one doesn't exist, we'll generate it for you

    https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/src/core.min.js

    // add / at the end to get a directory listing

    https://cdn.jsdelivr.net/gh/jquery/jquery/

    ref - https://www.jsdelivr.com/?docs=gh

    0 讨论(0)
  • 2020-12-13 12:16

    check your path ,this error will come if file was not exist into given path.

    0 讨论(0)
  • 2020-12-13 12:21

    This can be fixed by changing your URL, example bad:

    https://raw.githubusercontent.com/svnpenn/bm/master/yt-dl/yt-dl.js
    Content-Type: text/plain; charset=utf-8
    

    Example good:

    https://cdn.rawgit.com/svnpenn/bm/master/yt-dl/yt-dl.js
    content-type: application/javascript;charset=utf-8
    

    rawgit.com is a caching proxy service for github. You can also go there and interactively derive a corresponding URL for your original raw.githubusercontent.com URL. See its FAQ

    0 讨论(0)
  • 2020-12-13 12:28

    I had this error when i was using the azure storage as a static website, the js files that are copied had the content type as text/plain; charset=utf-8 and i changed the content type to application/javascript

    It started working.

    0 讨论(0)
提交回复
热议问题