'JSON' and 'jQuery' still undefined in Internet Explorer 7 and 8

烂漫一生 提交于 2019-12-11 03:35:32

问题


I got these three popular scripts included between my <head> tags

<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>

When I check for errors in IE7 and 8 I get the following:

  1. 'JSON' is undefined. (IE7)
  2. 'jQuery' is undefined. (IE7 and IE8)
  3. Object doesn't support this property or method. (IE8)

Can anybody tell me what is the cause of this, because I clearly am including those on my page, yet still come up as undefined. I have nothing else yet on my page besides these includes.

How can I fix this?


回答1:


jQuery 2.0 drops support for IE 6, 7 and 8, and is only meant for when you know you don't need to support those browsers. For most people the correct solution is to use jQuery 1.x instead, which is still officially supported:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>


来源:https://stackoverflow.com/questions/20319009/json-and-jquery-still-undefined-in-internet-explorer-7-and-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!