A personal repository of technical notes. - CSC

How to Debug JavaScript

Problem
Debugging JavaScript in Firefox
Debugging JavaScript in IE

Solution for Debugging JavaScript in Firefox

Firebug Method:
  1. Open page to debug in Firefox
  2. Start Firebug
  3. Click on the "Script" tab on top of Firebug pane
  4. Assign break points and step through code as you would with VS2005
Solution for Debugging JavaScript in IE6

Debugger line method:
  1. IE: Tools/Internet Options/Advanced Tab/Uncheck "Disable Script Debugging"
  2. VS: Add following line to JavaScript code:
    debugger;
  3. Add breakpoint to line above
  4. Remove line above after debugging complete
VS2005 Attach to Process Method:
  1. IE: Tools/Internet Options/Advanced Tab/Uncheck "Disable Script Debugging"
  2. VS: Solution Explorer/Right-Click .ASPX/View in Browser
  3. VS: Debug/Attach to Process...
    1. Attach to: Click Select.../Check Script
    2. Available Processes/Select iexplore.exe of .ASPX
    3. Click Attach
  4. VS: Debug/Windows/Script Explorer
  5. VS Script Explorer: Double-Click page to open scipt for setting break points

No comments:

Post a Comment