简体   繁体   English

除非打开开发者模式,否则 JavaScript 无法在 Internet Explorer 11 上运行

[英]JavaScript not working on Internet Explorer 11 unless Developer mode is on

JavaScript is not working on Internet Explorer 11 - even a simple alert() is not working, unless debugging mode (F12) is on. JavaScript 在 Internet Explorer 11 上不起作用 - 即使是简单的 alert() 也不起作用,除非调试模式 (F12) 处于打开状态。

I'm not using any console/log related code lines.我没有使用任何与控制台/日志相关的代码行。

<script type="text/javascript" src="./Common/JS/jquery-2.1.1.min.js"></script>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
       alert('HERE');
    });
</script>

Console Error:控制台错误:

Object doesn't support property or method 'addEventListener'对象不支持属性或方法“addEventListener”

I know that this question has been asked multiple times but even in the comments people are saying that suggested solutions didn't work with IE 11我知道这个问题已被多次询问,但即使在评论中人们也说建议的解决方案不适用于 IE 11

this line solved my issue, just make sure to add at the top of your head tag这条线解决了我的问题,只需确保在头顶添加标签

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11" />

Thanks to this answer https://stackoverflow.com/a/6771584/6240803感谢这个答案https://stackoverflow.com/a/6771584/6240803

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM