notquiteamonad
notquiteamonad

Reputation: 1169

MIME type in Chrome error

When I load my web application in Chrome it shows the folliwing in the console log:

Resource interpreted as Script but transferred with MIME type text/plain:

I think this is the cause of the problems I've been having (perfectly valid functions that work in the console, but not in the .js script files).

I've read that the solution is to put your <script type=s to "application/javascript". I have tried this, but it failed. Is there another solution?

Upvotes: 2

Views: 13665

Answers (1)

hanshenrik
hanshenrik

Reputation: 21513

theres an error with your server-sided code, the server sends "text/plain" when the browser expects "text/javascript"

.. how to fix this depends on what server you use (lighthttpd / apache / nginx / etc) , but.. if you have some scripting language like PHP (which nearly all webservers has these days) , you can use that to customize the MIME.. like

jsstuff.js.php

<?php header("content-type: text/javascript");?>
//javascript goes here!

Upvotes: 2

Related Questions