I get reports that a button does not work in my webapp on IE8 (and older). Everything works in IE9, FF and Chrome. The error is trig开发者_JAVA百科gered in this click-bind:
$("#save_refresh").click(function(e) {
alert('hello world!');
});
This is the html:
<input class='button' type='button' value='Save / Refresh' id='save_refresh' />
When clicking the button in IETester running IE8, the "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.
I agree with Quentin. You should download one of Microsoft's Internet Explorer Application Compatibility VPC Images to properly test your code. Paul Irish has a good article on the incompatibilities of Internet Explorer compatibility modes.
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. It's like putting a Chevrolet Metro engine in your Chevrolet Aveo so you can test drive the 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.
Microsoft provide virtual machines with older versions of Internet Explorer for testing.
Using IE9, you can switch to the IE7 or IE8 rendering engine. Press F12
and the developer panel should appear. The header bar has options to switch to the IE7 and IE8 Browser Modes (and their respective notorious Quirks Modes).
For IE6, you'll have to rely on Virtual Machines (as mentioned by Quentin above). Microsoft released XP Mode partly for this.
Internet explorer has compatibility mode for IE7 and IE8 (and even for Quirks mode), it which you can debug most of the issues. Rarely you need true installation of older version of IE
精彩评论