views:

1580

answers:

5

I'm trying to debug javascript code just by adding a breakpoint in VS2008, but the debugger's not stopping. Do I have to do some special setup in order to enable javascript debugging? Or does the code have to be in a separate js file?

A: 

Any particular browser? Mainly it works with IE, and needs script debugging enabled in the IE internet options (advanced => browsing).

Marc Gravell
A: 

I don't know about VS2008, but I know I've never been able to get the debugger to stop on a breakpoint in an aspx (as opposed to a linked js file).

If you are not running this in a project, but just debugging on the fly, be sure to attach to the browsers' process.

John MacIntyre
A: 

I know it's not what you asked, but I gotta plug Firebug for JS debugging, including breakpoints, watch statements, stepping, and a live JS console.

orip
Thanks, I already have that anyways.
Raúl Roa
+3  A: 

Did you uncheck the checkboxes in the settings

Tools-->Internet Options-->Advanced-->Browsing [heading]-->Uncheck "Disable Script Debugging (Internet Explorer)" and Uncheck "Disable Script Debugging (Other)"

Sometimes you need to restart the browser to get VS2008 to recognize that it has made some changes.

Have you tried to stick the "debugger;" keyword into your JavaScript file? This usually never fails me.

If you have IE8, you can debug right in the browser itself.

epascarello
Where have I to write `debugger`?
abatishchev
in the JavaScript file where you want it to break.
epascarello