在Internet Explorer 7和8中,"JSON"和"jQuery"仍未定义

Kid*_*ond 2 javascript jquery internet-explorer json jquery-cookie

我在我的<head>标签之间包含了这三个流行的脚本

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/json3/3.2.6/json3.min.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
Run Code Online (Sandbox Code Playgroud)

当我在IE7和8中检查错误时,我得到以下内容:

  1. "JSON"未定义.(IE7)
  2. 'jQuery'未定义.(IE7和IE8)
  3. Object不支持此属性或方法.(IE8)

任何人都可以告诉我这是什么原因,因为我清楚地将这些包括在我的页面上,但仍然是未定义的.除了这些包括之外,我的页面上还没有其他内容.

我怎样才能解决这个问题?

Sha*_*hai 7

jQuery 2.0 不再支持 IE 6,7和8,仅适用于您不需要支持这些浏览器的情况.对于大多数人来说,正确的解决方案是使用jQuery 1.x,这仍​​然是官方支持的:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)