【发布时间】:2019-12-17 07:51:37
【问题描述】:
我正在 Django 模板中加载 java-script 文件:
<script type="application/javascript" src="{% static 'online-v3.js' %}"></script>
它在 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.
我担心由于这个问题,在某些浏览器上可能根本无法加载 JS 文件。
这可能是什么原因,我该如何解决这个问题?
【问题讨论】:
-
我通过 HTML 使用路由器(由 .htaccess 文件调用)加载 .js 文件时收到此警告,不使用脚本元素中的任何类型属性,但仅在 Firefox 上,而不是在铬合金。 Firefox 中的错误?
标签: javascript html django firefox