简体   繁体   English

带有jQuery的Internet Explorer上的Javascript错误,但在Firefox上可以正常工作

[英]Javascript errors on internet explorer with jQuery but working fine on Firefox

A quick question I'm hoping someone can help me out with. 一个简单的问题,我希望有人可以帮助我。

On firefox our jQuery slider is working perfectly, however on viewing with internet explorer there are some javascript errors occurring. 在firefox上,我们的jQuery滑块运行正常,但是在使用Internet Explorer查看时,会发生一些JavaScript错误。 The website is http://foscam-uk.com/index.php 该网站是http://foscam-uk.com/index.php

Hoping there is a possible solution to this. 希望对此有可能的解决方案。

Kind Regards and Thank You! 亲切的问候,谢谢!

Errors: Webpage error details 错误:网页错误详细信息

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: Wed, 6 Jun 2012 22:36:43 UTC 用户代理:Mozilla / 4.0(兼容; MSIE 8.0; Windows NT 6.1; WOW64; Trident / 4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)时间戳:星期三,2012年6月6日22:36:43 UTC

Message: Object doesn't support this property or method Line: 5653 Char: 9 Code: 0 URI: http://foscam-uk.com/js/prototype/prototype.js 消息:对象不支持此属性或方法行:5653字符:9代码:0 URI: http : //foscam-uk.com/js/prototype/prototype.js

Message: Object doesn't support this property or method Line: 5988 Char: 5 Code: 0 URI: http://foscam-uk.com/js/prototype/prototype.js 消息:对象不支持此属性或方法行:5988字符:5代码:0 URI: http : //foscam-uk.com/js/prototype/prototype.js

Message: Object doesn't support this property or method Line: 2 Char: 5 Code: 0 URI: http://foscam-uk.com/skin/frontend/default/theme316/js/scripts.js 消息:对象不支持此属性或方法行:2字符:5代码:0 URI: http : //foscam-uk.com/skin/frontend/default/theme316/js/scripts.js

Message: Object doesn't support this property or method Line: 5736 Char: 7 Code: 0 URI: http://foscam-uk.com/js/prototype/prototype.js 消息:对象不支持此属性或方法行:5736字符:7代码:0 URI: http//foscam-uk.com/js/prototype/prototype.js

Message: Object doesn't support this property or method Line: 5988 Char: 5 Code: 0 URI: http://foscam-uk.com/js/prototype/prototype.js 消息:对象不支持此属性或方法行:5988字符:5代码:0 URI: http : //foscam-uk.com/js/prototype/prototype.js

Message: Object doesn't support this property or method Line: 73 Char: 11 Code: 0 URI: http://foscam-uk.com/index.php 消息:对象不支持此属性或方法行:73字符:11代码:0 URI: http : //foscam-uk.com/index.php

IE has some limitations on number of CSS and JS files. IE对CSS​​和JS文件的数量有一些限制。 (Around 30). (大约30岁)。 I didn't count but seems like you have tons of JS and css file references. 我没有数,但似乎您有大量的JS和CSS文件引用。 If you exceed this IE basically stop downloading the script or css file. 如果超出此IE,则基本上停止下载脚本或CSS文件。 You can verify it yourself by using Fiddler. 您可以使用Fiddler自己进行验证。

Try to compact them to single file with compressor tools (ex: http://developer.yahoo.com/yui/compressor/ ) 尝试使用压缩工具将它们压缩为单个文件(例如: http : //developer.yahoo.com/yui/compressor/

prototype.js seems to be throwing errors in every browser but these seem to have no effect on your site. prototype.js似乎在每个浏览器中都会引发错误,但这些错误似乎对您的网站没有影响。

your site works fine in IE7 and IE10. 您的网站在IE7和IE10中运行良好。 In IE8, your version of jQuery throws an error, not the slider code. 在IE8中,您的jQuery版本引发错误,而不是滑块代码。 I would upgrade your 1.7.1 version of jQuery to 1.7.2 (the latest). 我会将您的jQuery 1.7.1版本升级到1.7.2(最新版本)。

So it looks like you're loading a several third party libraries. 因此,看起来您正在加载几个第三方库。 You're loading PrototypeJS, Scriptaculous, jQuery, and jQuery plugins*. 您正在加载PrototypeJS,Scriptaculous,jQuery和jQuery插件*。 It appears to me what you have is not so much a JavaScript problem as a plugin organization problem. 在我看来,您所拥有的不只是一个JavaScript问题,而是一个插件组织问题。

Now, you do appear to be using things like jQuery.noConflict() in one place, but then not in another. 现在,您似乎jQuery.noConflict()在一个地方使用了jQuery.noConflict()类的东西,但在另一个地方却没有使用。

My suggestion is to deactivate all the current modules you're using on the site which inject JavaScript, and then re-enable them one at a time. 我的建议是停用网站上正在使用的所有当前模块,这些模块会注入JavaScript,然后一次重新启用它们。 Each time you re-enable a plugin, check to see whether that, and all the other plugins are also working. 每次您重新启用插件时,请检查是否启用了该功能,其他所有插件也都在工作。


*Actually, you're loading more than just a few libraries. *实际上,您正在加载的不仅仅是几个库。 You're actually loading two versions of jQuery , plus Prototype. 您实际上正在加载jQuery的两个版本以及Prototype。 This is not a good practice. 这不是一个好习惯。 Here's what I can see, not counting the Magento generated code that is being inserted: 这是我所看到的,不算要插入的Magento生成的代码:

  • Prototype 1.7 原型1.7
  • Credit Card Validation Javascript 信用卡验证Javascript
  • Really easy field validation with Prototype 使用Prototype进行现场验证非常简单
  • script.aculo.us builder.js script.aculo.us builder.js
  • script.aculo.us effects.js script.aculo.us effects.js
  • script.aculo.us controls.js script.aculo.us controls.js
  • script.aculo.us slider.js script.aculo.us slide.js
  • jQuery 1.4.2 jQuery 1.4.2
  • jCarouselLite jCarouselLite
  • jQuery 1.7.1 jQuery 1.7.1
  • TMSlider: jQuery based image slider TMSlider:基于jQuery的图像滑块
  • jQuery Easing v1.3 jQuery轻松v1.3

You need to do a rethink as to how you're handling some of these effects. 您需要重新考虑如何处理这些影响。 There's a great deal of overlap in what these libs do, and you'd be better off seeing if there's a way to create some sanity in which modules you're choosing. 这些库的工作有很多重叠之处,您最好看看是否有一种方法可以使您选择的模块更加合理。

I had a similar issue with my client-side script. 我的客户端脚本也有类似的问题。 The IE10 F12 Dev tools script tab showed errors on jQuery syntax even though the site worked in IE8 and IE9. 即使该站点在IE8和IE9中都可以运行,IE10 F12开发工具脚本选项卡仍显示jQuery语法错误。

One of the libraries I used (Telerik Kendo UI) was not IE10 compatible yet. 我使用的一种库(Telerik Kendo UI)还不兼容IE10。

In order to force IE10 to show the page, I had to add this meta tag to the very top (first item in head) of my HEAD tag: 为了强制IE10显示页面,我必须将此meta标签添加到HEAD标签的最顶部(头部的第一项):

 <meta http-equiv="X-UA-Compatible" content="IE=9" />

Then the pages worked again. 然后页面再次工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jquery在Firefox中工作但不在Internet Explorer中工作 - Jquery working in Firefox but not Internet Explorer Internet Explorer 中的 Javascript/Jquery 错误 - Javascript/Jquery Errors in Internet explorer jQuery滚动在Internet Explorer或Firefox中不起作用 - JQuery scrolling not working in Internet Explorer or Firefox 元标记中的javascript在Firefox和Internet Explorer上不起作用 - javascript in meta tag not working on firefox and internet explorer 我已经使用javascript和ajax创建了一个在线打字测试页面。 该代码在Google Chrome Chrome浏览器中正常运行,但在Internet Explorer中无法正常运行 - i have created a online typing test page using javascript and ajax. the code is working fine in google chrome firefox, but not in internet explorer 合并jquery的Javascript在Internet Explorer中不起作用 - Javascript incorporating jquery not working in Internet Explorer 包含外部HTML的JavaScript在Chrome中运行,但在Internet Explorer和Firefox中不起作用 - JavaScript to include external HTML is working in Chrome but not in Internet Explorer and Firefox 幻灯片只能在Firefox中使用,而不能在Internet Explorer中使用 - slideshow working in firefox but not internet explorer FadeIn不适用于FireFox / Internet Explorer - FadeIn not working for FireFox/Internet Explorer 在Chrome和Firefox中可以使用Canvas元素+ Javascript,而不能在Internet Explorer中使用 - Canvas element + Javascript working in Chrome and Firefox, not in Internet Explorer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM