Firefox上的JavaScript MIME类型警告 [英] JavaScript MIME type warning on Firefox

查看:131
本文介绍了Firefox上的JavaScript MIME类型警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Django模板中加载Java脚本文件:

I am loading the java-script file in Django template:

<script type="application/javascript" src="{% static 'online-v3.js' %}"></script>

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

It is loading properly on Chrome. But, on Firefox I get the following warning:

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文件可能根本无法加载.

I fear that due to this problem, on some browser the JS file might not load at all.

可能的原因是什么?如何解决此问题?

What is the possible reason for this and how can I solve this issue?

推荐答案

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

在html5规范中,除非不是 javascript

In html5 spec the type is not required unless it is not javascript

这篇关于Firefox上的JavaScript MIME类型警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆