html文件被本地应用阻止,CSS文件被阻止:MIME类型不匹配(X-Content-Type-Options:nosniff)...

我正在开发一个Angular 4应用程序,我想应用一些全局样式.在

tutorial at the angular site之后,我在我的应用程序的根目录中创建了一个“styles.css”文件,我指的是我的应用程序的index.html中的样式表:

角度应用程序已成功编译:

$ng serve

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **

[...]

webpack: Compiled successfully.

但是当我在Chromium浏览器中访问http://localhost:4200时,控制台显示错误

GET http://localhost:4200/styles.css

在Firefox浏览器中,错误更明确一些:

GET

http://localhost:4200/styles.css [HTTP/1.1 404 Not Found 15ms]

The resource from "http://localhost:4200/styles.css" was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).

两个文件index.html和styles.css都位于我的角度应用程序的根目录中.

我试图得到more info about the problem:

nosniff

Blocks a request if the requested type is

"style" and the MIME type is not "text/css", or

"script" and the MIME type is not a JavaScript MIME type.

但我不明白为什么它的请求很臃肿,因为我在引用样式表时指定了type =“text / css”.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值