简体   繁体   English

在Win7上,如何在旧版本的IE中进行调试

[英]On Win7, how do I debug in older versions of IE

I get reports that a button does not work in my webapp on IE8 (and older). 我得到报告说IE8(以及更早版本)的webapp中的按钮不起作用。 Everything works in IE9, FF and Chrome. 一切都适用于IE9,FF和Chrome。 The error is triggered in this click-bind: 在此click-bind中触发错误:

$("#save_refresh").click(function(e)  {
  alert('hello world!');
});

This is the html: 这是html:

<input class='button' type='button' value='Save / Refresh' id='save_refresh' />

When clicking the button in IETester running IE8, the "hello world!" 单击运行IE8的IETester中的按钮时,“hello world!” is not shown and I get this error: 没有显示,我收到此错误:

Line: 17
Character: 28691
Error:
Code: 0
URL: jquery-1.6.1.min.js

So my question is: is there anything wrong with my above code OR does anyone know how to debug javascript in older version of IE. 所以我的问题是:我的上述代码有什么问题或者有人知道如何在旧版本的IE中调试javascript。

I agree with Quentin . 我同意昆汀的观点 You should download one of Microsoft's Internet Explorer Application Compatibility VPC Images to properly test your code. 您应下载Microsoft的Internet Explorer应用程序兼容性VPC映像之一,以正确测试您的代码。 Paul Irish has a good article on the incompatibilities of Internet Explorer compatibility modes . Paul Irish有一篇关于Internet Explorer兼容模式不兼容的好文章。

The IE9 compatibility modes are unreliable in terms of giving you an accurate picture of how the browser will actually render your page and how your page will behave under that browser. IE9兼容模式不可靠,可以让您准确了解浏览器实际呈现页面的方式以及页面在该浏览器下的行为方式。 It's like putting a Chevrolet Metro engine in your Chevrolet Aveo so you can test drive the Metro. 这就像在你的雪佛兰乐骋中放置一辆雪佛兰Metro引擎,这样你就可以试驾地铁。

That said, when using IE8, you can just hit F12 like in IE9, but with IE7, you need to have a copy of Visual Studio and use the debugger keyword. 也就是说,当使用IE8时,你可以像IE9一样点击F12,但是使用IE7,你需要有一个Visual Studio的副本并使用debugger关键字。

Microsoft 为虚拟机提供旧版Internet Explorer以进行测试。

Using IE9, you can switch to the IE7 or IE8 rendering engine. 使用IE9,您可以切换到IE7或IE8渲染引擎。 Press F12 and the developer panel should appear. F12 ,将出现开发人员面板。 The header bar has options to switch to the IE7 and IE8 Browser Modes (and their respective notorious Quirks Modes). 标题栏可以选择切换到IE7IE8浏览器模式 (以及它们各自臭名昭着的Quirks模式)。

For IE6, you'll have to rely on Virtual Machines (as mentioned by Quentin above). 对于IE6,您将不得不依赖虚拟机(如上面的Quentin所述)。 Microsoft released XP Mode partly for this. 微软部分为此发布了XP Mode

Internet explorer has compatibility mode for IE7 and IE8 (and even for Quirks mode), it which you can debug most of the issues. Internet Explorer具有IE7和IE8的兼容模式 (甚至是Quirks模式),您可以调试大部分问题。 Rarely you need true installation of older version of IE 您很少需要真正安装旧版本的IE

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM