Skip to content Skip to sidebar Skip to footer

Im Getting The Message "resource Interpreted As Script But Transferred With MIME Type Text/html"

My js files are not getting loaded and Im getting the message 'resource interpreted as script but transferred with MIME type text/html'.May I know how I can solve this issue. Thank

Solution 1:

This sounds more like a server issue than a javascript issue.

It seems rather odd that any server would not have a MIME type set for .js files. Do the files have a different extension?

Perhaps your HTML needs to be modified to be more specific?

<script type="text/javascript" language="javascript" src="functions.js"></script>

You'll have to provide a bit more information to get a more specific answer to your question.


Solution 2:

As travis already said it is probably because of the server misconfiguration.

Assuming the full URL to your js file is $SCRIPT_URL you can run any of the following commands in the console to figure out the content type your server server your js file with:

$ wget -O /dev/null --server-response $SCRIPT_URL 2>&1 | grep -i content-type
$ curl --include --silent $SCRIPT_URL | grep -i content-type

If you get something like Content-Type: application/x-javascript the server is ok.

But I suppose your output would be something like Content-Type: text/html; charset=UTF-8 that means your server config needs to be fixed. That fix is server dependent and you should provide more info, such as what server do you use so that we could help you.

Kudos to travis.


Post a Comment for "Im Getting The Message "resource Interpreted As Script But Transferred With MIME Type Text/html""