main.css没有加载,因为它的MIME类型“text / html”不是“text / css”?

时间:2017-10-18 11:02:36

标签: javascript html css firefox

SA

我知道这个问题已有多个答案,但没有一个对我有用,因为我有点奇怪。

基本上我有几页说:

index.html
contacts.html
find.html

header.html // main.css files contains  styling for this header file which is dynamically loaded into different pages.

问题在于,当我将头文件加载到index.htmlcontacts.html时,它加载正常,但是当我在find.html加载时,它会弹出浏览器控制台错误说:< / p>

Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead[Learn More]  JquerySock.js:1
The stylesheet http://localhost:20012/Duck/main.css was not loaded because its MIME type, “text/html”, is not “text/css”. search
The stylesheet http://localhost:20012/Duck/CSS/search.css was not loaded because its MIME type, “text/html”, is not “text/css”. search
The stylesheet http://localhost:20012/Duck/mainelements/aside.css was not loaded because its MIME type, “text/html”, is not “text/css”.

请求标题content-type恰好是text/css,但响应出现时text/html并不知道原因。 仅供参考:我正在使用Debian(Jessie)。 Firefox ESR v52.4.0

1 个答案:

答案 0 :(得分:0)

看起来您的代码需要登录才能访问CSS样式表,并返回HTML登录页面而不是CSS。

此处'样式'是包含css的文件夹。

<location path="~/Styles">
<system.web>
  <authorization>
    <allow users="*"/>
  </authorization>
</system.web>