Resource interpreted as Script but transferred with MIME type text/x-c++

风格不统一 提交于 2019-12-01 03:26:24

问题


LESS beginner.

Wrote a test html below

<head>
    <link rel="stylesheet" type="text/css" href="404.less">
    <script src="http://lesscss.googlecode.com/files/less-1.3.0.min.js" type="text/javascript"></script>
</head>
<body>test</body>

But got a warning in Chrome

Resource interpreted as Script but transferred with MIME type text/x-c++: "http://lesscss.googlecode.com/files/less-1.3.0.min.js".

Why?


回答1:


You probably want your link tag to say:

<link rel="stylesheet/less" type="text/css" href="404.less">

That said, if this is being served from a webserver it could be that that's detecting the mime type wrong from the file extension. If it's an apache server though, there's an easy fix. Add this to/create a .htaccess file in your webroot, containing the line:

AddType text/css less 



回答2:


I had a similar issue with twitter follow-me buttons when I was reviewing local html files in chrome. To fix this I just fired up web matrix 2.0 and pointed at my folder. Hope this helps.



来源:https://stackoverflow.com/questions/11562521/resource-interpreted-as-script-but-transferred-with-mime-type-text-x-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!