Resource blocked due to MIME type mismatch
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Other
Current behavior
I’m trying a simple bootstrap template. No JS and CSS are loaded because error: “Resource «http://127.0.0.1:5500/css/dashboard.css» blocked due to MIME type mismatch («text/html») (X-Content-Type-Options: nosniff)”
I tried following this advice, however errors are gone and no CSS/JS are loaded. Opening the same “test” page in browser without live-server works and renders fine.
This is how I include CSS:
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" >
Environment
Browser:
- [x] Firefox version 68
For Tooling issues:
- Live Server: 5.6.1
- Platform: Windows 10
- Visual Studio Code: vsCodium 1.38.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
Resource blocked due to MIME type mismatch (X-Content ...
js. You can try to directly request the script file (copying and pasting url) and see if you can retrieve it. You can...
Read more >Resource blocked due to MIME type mismatch (X ... - YouTube
JavaScript : Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff) [ Gift : Animated Search Engine ...
Read more >Js file blocked due to MIME type (“text/html”) mismatch (X ...
The problem is NodeJS doesn't render HTML pages like other servers do, we have to specify the path for static files (such as...
Read more >X-Content-Type-Options - Cloudflare Community
The resource from “https://(website domain).com/” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). We are ...
Read more >Blocked due to MIME type mismatch [#3275328] | Drupal.org
Browser error: "The resource from “https://xxxxxxx.com/libraries/colorbox/jquery.colorbox-min.js?v=9.3.9” was blocked due to MIME type ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this. The problem is the live server isn’t serving relative to the index.html, its doing it relative to the workspace / package. i.e. I have
open index.html while vscode is open on the root folder and the browser will error that files are incorrect or it can’t find js scripts. Temporary solution is to open vscode directly onto the /dist folder, start the live-server and then it will work fine.
The problem is live-server is serving css with content-type incorrectly set as text/html instead of text/css. Go to networks tab (In Chrome dev tools). Click on one of the red .css files that failed to load. Click on Response Headers and confirm
Content-Type: text/html; charset=utf-8
(which is incorrect)Update: On further investigation I have noticed that my paths when linking the CSS was incorrect. So check your paths. The fact that live-server is trying to serve something with an incorrect type still means this is a possible bug.