Tuesday, 5 June 2012

debug javascript using IE


First thing is to make sure the Internet Explorer breaks for the JavaScript. By default, the script debugging is disabled in IE. To enable this, go to: Tools - Internet Options - Advanced (the Advanced tab in Internet Option dialog box) Under the ’Browsing’ section, uncheck the following item: Disable Script Debugging (Internet Explorer)
With the script debugging enabled, Visual Studio will now step through the JavaScript code as well. If the asp.net application you are debugging has any global JavaScript code, pressing F11 to start the program will break the execution at the very first line of the JavaScript code. From there on, if you keep pressing F11, you will be able to step through every line in the application.

eg:
<script type="text/javascript">
function test()
{
        debugger;
        alert('debugging');
}
    </script>

No comments:

Post a Comment