jQuery是IE11中的未定义异常 [英] jQuery is undefined exception in IE11

查看:955
本文介绍了jQuery是IE11中的未定义异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IE11中,我收到此异常

In IE11 I get this exception

'jQuery'未定义

'jQuery' is undefined

我在任何其他浏览器中都没有收到此错误.导致问题的代码是

I do not get this error in any other browser. The code that is causing the problem is

jQuery(document).ready(function(){

任何人都知道为什么会这样,可能是什么原因导致了问题?

Any one know why is that and what might be causing the problem?

推荐答案

在IE11中,根据您的安全设置,可能会阻止对外部CDN的访问.

In IE11, depending on your security settings, access to external CDNs may be blocked.

因此,您将必须添加2个JQuery URL,一个用于(每个其他浏览器),另一个在本地.

Thus, you will have to add 2 JQuery URLs, one for (every other browser) and one locally.

// First try loading jQuery from Google's CDN
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

// Fall back to a local copy of jQuery if the CDN fails
<script>
window.jQuery || document.write('<script src="/js/jquery.min.js"><\/script>')
</script>

参考: https://bugsnag.com/blog/jquery-is-not-定义原因解决方案

这篇关于jQuery是IE11中的未定义异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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