2017-10-18 95 views
0

SAmain.css未加載,因爲其MIME類型「text/html」不是「text/css」?

我知道這個問題已經有多個答案,但沒有與我一起工作,因爲我有點奇怪。

基本上我有幾頁說:

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加載它,它會彈出瀏覽器控制檯錯誤他說:

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

回答

0

看起來您的代碼需要登錄才能訪問CSS樣式表,並返回HTML登錄頁面而不是CSS。

這裏'樣式'是包含CSS的文件夾。

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

我知道你複製粘貼這個答案。無論如何,我可以通過「http:// localhost:20012/Duck/main.css」作爲url鏈接訪問我的樣式表。順便說一句你把代碼放在哪裏? – Whatever

+0

是的,我複製了..對不起,我忘了把鏈接。 –

+0

https://stackoverflow.com/questions/5413107/headercontent-type-text-css-is-working-in-firefox-and-chrome-but-in-inter @Whatever ..看看這兩個.. http://galleryproject.org/node/27061 –

相關問題