Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

css

less

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?

like image 297
fxp Avatar asked Jul 19 '12 14:07

fxp


1 Answers

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 
like image 87
Alan Avatar answered Oct 24 '22 07:10

Alan