Firefox 上的 JavaScript MIME 类型警告

Ran*_*ngh 4 html javascript django firefox

我正在 Django 模板中加载 java-script 文件:

<script type="application/javascript" src="{% static 'online-v3.js' %}"></script>
Run Code Online (Sandbox Code Playgroud)

它在 Chrome 上正确加载。但是,在 Firefox 上,我收到以下警告:

The script from “http://127.0.0.1:8000/static/myscript.js” was loaded even though its MIME type (“text/plain”) is not a valid JavaScript MIME type.
Run Code Online (Sandbox Code Playgroud)

我担心由于这个问题,在某些浏览器上,JS 文件可能根本无法加载。

这可能是什么原因,我该如何解决这个问题?

cha*_*tfl 5

删除type或将其更改为"text/javascript"

在 html5 规范中,type除非它不是javascript,否则不需要