How to launch IE8 debugger with debugger; command

2019-08-15 20:06发布

问题:

The javascript command 'debugger;' will start a debugger.

 debugger;

But (with Visual Studio 2008 installed) I cannot seem to figure out how to get this to break into the IE8 debugger. It will give me a list of choices such as VS2008, VS2010, Microsoft Script debugger.

If I do the following it will break into the (lightning fast) VS2008 debugger...

 throw Error("d");

... but I want to get it to do so when I use the 'debugger;' command. How can I do this

回答1:

Step 1: Open the page you want to debugger
Step 2: Open IE8 Debugger and click Script -> Start Debugging
Step 3: Then It will break into the IE8 debugging while execute the code.

Hope it helps!



回答2:

If you need to jump into the debugger before you have access to the Start Debugging command, such as in an onLoad handler, you can use any illegal instruction to pop into the IE8 debugger, such as:

null.length;