because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
<link?rel="stylesheet"?type="text/css"?href="/static/css/reset.css"> <link?rel="stylesheet"?type="text/css"?href="/static/css/common.css">
為什么在index.html里加入這兩句之后 瀏覽器 提示
Refused to apply style from 'http://localhost:1125/static/css/reset.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
2018-04-02
我也遇到了這個問題,是因為靜態(tài)資源訪問限制導(dǎo)致。我用的express框架,添加上app.use(express.static(path.join(__dirname, 'views'))); 就可以訪問到靜態(tài)資源文件
http://www.expressjs.com.cn/starter/static-files.html
view下是我放置js、css的地方
2018-04-24
webpack下這個問題我碰到了兩次,糾結(jié)了兩次。
第一次是通過設(shè)置module.noParse不解析指定的第三方庫的路徑下js文件解決,發(fā)現(xiàn)原因是第三方庫在document.write引用自身其他依賴css、config.js時用的是相對路徑,結(jié)果導(dǎo)致瀏覽器請求靜態(tài)資源時路徑錯誤返回404、Cannot GET xxx等,自然就解析成了'text/html。
第二次原因同上,粗暴點直接把源碼里的依賴路徑改成項目對應(yīng)路徑下就搞定了。
嘗試設(shè)置 HTTP header X-XSS-Protection=0、X-Content-Type-Options = nosniff都無疾而終,且不論削弱了防XSS的能力。
2018-04-11
我去掉 contentBase 但是還是報這個錯啊
2018-03-30
看下webpack.config.js里有沒有設(shè)置publicPath
另外看下有沒有對webpack-dev-server設(shè)置contentBase,我是額外設(shè)置了contentBase 導(dǎo)致這個問題,不設(shè)置它, 默認是當前目錄就可以了。
最后看下index.html, static, 和src 這三個文件夾的目錄層級關(guān)系。以下是我的層級關(guān)系。
2018-03-29
請問問題解決了嘛?我也遇到這個問題
2018-03-29
你怎么解決的呢?