javascript - IE8 正在使用 jQuery 抛出错误

标签 javascript jquery internet-explorer-8

我在使用 IE7/IE8 和 jQuery 时遇到了一些问题。我的代码适用于 IE 10、FF、Chrome、Safari、Mobile Safari、Mobile Chrome。

现在,为了进行调试,我删除了自己的 JS 文件。所以这是代码:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

此页面上没有引用其他 JS。我已经删除了所有其他 JS 引用,并且页面本身没有执行 JS。当页面在 IE8 中加载时,出现此错误:

Line: 4
Error: Object doesn't support this property or method

enter image description here

调试器显示以上内容。不确定问题出在哪里。任何帮助是极大的赞赏。

附言- 这是我第一次“认真”的 Web 开发工作,现在我明白了为什么 IE 在开发社区中如此讨厌。

最佳答案

jQuery 2.0 放弃了对某些浏览器的支持。请参阅 http://blog.jquery.com/2013/04/18/jquery-2-0-released/ 上的发布帖子

引用自帖子:

No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.

Reduced size: The final 2.0.0 file is 12 percent smaller than the 1.9.1 file, thanks to the elimination of patches that were only needed for IE 6, 7, and 8. We had hoped to remove even more code and increase performance, but older Android/WebKit 2.x browsers are now the weakest link. We’re carefully watching Android 2.x market share to determine when we can cross it off the support list, and don’t expect it to take very long.

保留 jQuery 1.9(编辑 2015-11-17:jQuery 1.11.3 是 jQuery 的当前 1.x 版本。)如果 IE 6/7/8 是一个问题。

关于javascript - IE8 正在使用 jQuery 抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17392219/

相关文章:

javascript - 如何使用 Select2 从原始选择中过滤掉选项标签?

javascript - 是否可以在不调用 getter 的情况下将多个对象与 getter 合并

javascript - 在 Javascript 中将键值对的 JSON 数组转换为 JSON 字符串数组

html - CSS 下拉菜单在 IE 8 中不起作用

javascript - 如何将图像存储和检索到 localStorage?

javascript - 通过jquery模拟提交按钮并收集所有html输入值

javascript - 单击更改拇指组的类别

jQuery - 在滚动时展开导航框中的元素

css - 调整画廊中缩略图的渲染

javascript - WordPress 的 video.js : JavaScript error in IE 8