为什么我无法在Internet Explorer 11中加载JavaScript文件

问题描述 投票:0回答:1

在Chrome中,一切正常,但是在Internet Explorer 11中,我无法加载我的JavaScript文件。

<script src="~/js/portal/common.js"></script>

我如上所述添加我的JavaScript。

javascript internet-explorer-11
1个回答
0
投票

在HTML5中,<script></script>的默认类型属性为application/javascript,这就是您的实现在Chrome中运行的原因。

对于较旧的浏览器,如果没有标准处理,则应使用<script type="text/javascript"></script>

另请参见:https://www.iana.org/assignments/media-types/media-types.xhtml

© www.soinside.com 2019 - 2024. All rights reserved.