Javascript MIME Type not Set Properly

I’m building some web apps with Python/Tornado.

Some of my (HTML) pages have:

<script src="/static/some_script.js" type="text/javascript"></script>

When I load the page in FireFox, I get the warning:

"The script from “http://localhost:8086/static/some_script.js” was
loaded even though its MIME type (“text/plain”) is not a valid
JavaScript MIME type."

Why does the browser think the MIME type is "text/plain" instead of "text/javascript"? Where is it getting that idea from….?

I also load:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

and

<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js" type="text/javascript"></script>

for which I don’t get the same warning…..

43 thoughts on “Javascript MIME Type not Set Properly”

Leave a Comment