Search code examples
javascriptinternet-explorerdebuggingie-developer-toolsjavascript-debugger

How to make JavaScript break into IE built-in debugger (F12) rather than Visual Studio debugger?


I often use this to debug JavaScript in IE (fiddle):

if (confirm("Debug from here?"))
    debugger;

If I choose "yes", I see the prompt to start Visual Studio just-in-time debugger, which I proceed with to debug the script in Visual Studio.

Now I want to use IE built-in debugger instead of Visual Studio. I use this workaround:

if (confirm("Debug from here?"))
    throw "debug";

It works, but I have to check "Continue after exception" in IE built-in debugger every time I hit throw. Also, throw is different from debugger (which just continues execution if debugging is disabled in IE options).

Is there a way to make debugger keyword to break into into IE built-in debugger (F12) rather than Visual Studio debugger?

Setting breakpoints in IE F12 tools, then refreshing the page with F5 is not an option, because the page is a postback.

EDITED. Chrome browser actually gives me the desired behavior. To see what I mean, open Chrome, hit F12 to open Dev tools, then navigate to http://jsfiddle.net/jTwsh. Click [OK] upon confirm and you should get into debugger right on the debugger line.


Solution

  • Suggest to disable the Just-In-Time debugger for Script; if you do not want to use it for.

    See the below reference on how to enable/disable JIT Debugger:

    Enable/Disable Just-In-Time Debugging

    I am using IE8, there i need to start the script debugging by pressing 'Start Debugging' button or F5 under 'Script' tab in Developer Tools.

    See the attached screenshot:

    Developer Tools Screenshot