使用最新的jquery版本时,JSON是未定义的错误

时间:2013-08-13 07:13:56

标签: javascript jquery html internet-explorer

请参阅下面的html代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
        <title></title>
        <script src="Scripts/jquery-2.0.0.min.js"></script>
 </head>
<body>
<div id="container"></div>
</body>
</html>

当在IE7浏览器中打开此html页面时,它会抛出错误,如“ JSON”未定义,如果在IE8浏览器中打开相同意味着它会抛出错误,如“对象不支持属性或方法'addEventListener'

我该如何解决这个问题?

谢谢,

希瓦

2 个答案:

答案 0 :(得分:2)

jQuery 2不支持IE 8及更早版本。如果您想支持这些浏览器,请使用(仍受支持的)jQuery 1.x分支。

- http://jquery.com/browser-support/

答案 1 :(得分:1)

您应该仅对IE 6,7,8 older versions IE中不支持的As promised, this version leaves behind the older Internet Explorer 6, 7, and 8 browsers. In return it is smaller, faster, and can be used in JavaScript environments where the code needed for old-IE compatibility often causes problems of its own. Jquery 2.0使用 Jquery 1.9版

You can (and should) continue to use jQuery 1.9 (and the upcoming 1.10) on web sites that need to accommodate older browsers. 但不要担心,jQuery团队仍然支持在IE 6/7/8上运行的1.x分支。 {{1}}

阅读jquery-2-0-released