为什么我在控制台中收到此错误?
拒绝执行" https://www.googleapis.com/customsearch/v1?key=API_KEY&q=flower&searchType=image&fileType=jpg&imgSize=small&alt=json "中的脚本,因为其MIME类型('application/json')不可执行,并且严格的MIME类型检查已启用.
我在IIS中有一个问题,我已经安装了一个使用.NET运行的Web应用程序,但是当你导航到它时,没有显示任何图像并且没有使用CSS,因此页面完全没有格式化.
我很难过,但我想知道它是否与允许的MIME类型有关,所以当我注意到MIME类型选项不存在时,我会检查哪些是允许的.
当您单击某个站点时,我可以在IIS中的另一台服务器上的IIS中看到它,但它在此服务器上不存在.有人知道吗:
a)为什么不存在以及如何将其取回b)如果可能是问题的原因导致CSS未被检测到并且没有显示图像?
我希望我已经正确解释了这一点,但很乐意向任何有兴趣帮助的人提供更多信息!:-)
谢谢
此错误仅在 chrome 中显示。我正在搜索此问题,但尚未找到任何
令人满意的解决方案。我附上了该错误的屏幕截图。请为此提出一些想法。错误图片
我有一个CSS文件,我的本地开发服务器(webpack)提供的服务显然是错误的mime类型.
Refused to apply style from 'http://localhost:10001/font-awesome/css/font-awesome.min.css'
because its MIME type ('text/html') is not a supported stylesheet MIME type,
and strict MIME checking is enabled.
Run Code Online (Sandbox Code Playgroud)
反正有禁用此功能吗?我认为这是一个镀铬设置.至少对于特定的主机.
深入研究webpack配置,如果它不做这样基本的事情通常是令人沮丧的牦牛剃须练习.
大多数其他答案指的是修复服务器的方法.我只是想破解这个客户端,因为服务器很顽固.
有关:
我的离子构建工作完美,直到我想在我的iPhone上测试,所以我停止了我的服务器,然后做了一个ionic serve --address localhost,我注意到我的样式表不再加载...所以我杀了服务器再次回到ionic serve和错误坚持..
(index):1拒绝从' http:// localhost:8100/build/main.css ' 应用样式,因为它的MIME类型('text/html')不是受支持的样式表MIME类型,并且启用了严格的MIME检查.
我已经尝试清除缓存localhost:8100并重建项目,但错误仍然存在......
有任何想法吗?我几乎被困住直到这个问题得到解决:(
编辑:我最终修复它的方式可能不是最好的..但至少它再次起作用.我刚进入我的github存储库,我的应用程序已下载main.css并粘贴到build文件夹中,因此我没有遇到任何问题.
我的 reactjs 项目出现以下错误。我已经展示了我的文件夹结构。
Refused to apply style from 'http://localhost:8093/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Run Code Online (Sandbox Code Playgroud)
在这里,我包含了javascript,但是我得到的mime类型无效:
<script type="text/javascript" src="{{ asset('/dashboard/js/components.js') }}"></script>
<script type="text/javascript" src="{{ asset('/dashboard/js/custom.js') }}"></script>
<script type="text/javascript" src="{{ asset('/dashboard/vendors/slimscroll/js/jquery.slimscroll.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('/dashboard/vendors/raphael/js/raphael-min.js') }}"></script>
<script type="text/javascript" src="{{ asset('/dashboard/vendors/d3/js/d3.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('/dashboard/vendors/c3/js/c3.min.js') }}"></script>
Run Code Online (Sandbox Code Playgroud)
而且我得到以下错误:
The script from “http://localhost/Project/public/dashboard/vendors/flotchart/js/jquery.flot.pie.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.[Learn More] home
Loading failed for the <script> with source “http://localhost/Project/public/dashboard/vendors/flotchart/js/jquery.flot.pie.js”. home:2091:1
The script from “http://localhost/Project/public/dashboard/vendors/flot.tooltip/js/jquery.flot.tooltip.min.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME …Run Code Online (Sandbox Code Playgroud) 我正在开发一个在 npm 的 webpack-dev-server 上运行的 React 应用程序。运行服务器后,我注意到我在浏览器控制台中收到以下消息:
“拒绝应用来自‘ http://localhost:8080/css/index.css ’的样式,因为它的 MIME 类型(‘text/html’)不是受支持的样式表 MIME 类型,并且启用了严格的 MIME 检查。”
除了标题为 style.css 的自定义 css 文件之外,我能够获取以下所有资源。当我直接从包含的文件夹运行应用程序(而不在本地服务器上运行)时,style.css 文件加载没有问题。
我需要在 webpack 中使用 css 加载器吗?
我已经查看了以下帖子并尝试了所有建议,但无济于事:
在 index.html 中,我使用以下格式的链接标签:
<link rel="stylesheet" type="text/css" href="css/style.css"
Run Code Online (Sandbox Code Playgroud)
这是我的 webpack.config.js 文件:
const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
},
plugins: [ …Run Code Online (Sandbox Code Playgroud) index.html在Angular 6应用程序中添加以下样式时,出现以下错误。
拒绝应用来自“ http:// localhost:1234 / node_modules / primeicons / primeicons.css ”的样式,因为它的MIME类型('text / html')不是受支持的样式表MIME类型,并且启用了严格的MIME检查。
<link rel="stylesheet" type="text/css" href="/node_modules/primeicons/primeicons.css" />
<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/themes/nova-light/theme.css" />
<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
Run Code Online (Sandbox Code Playgroud)
我该如何解决该错误?
javascript ×4
mime-types ×4
angular ×2
css ×2
reactjs ×2
webpack ×2
asp.net-mvc ×1
html ×1
iis-7.5 ×1
ionic2 ×1
json ×1
node.js ×1
primeng ×1