JS debugging in VS.NET - how?!

  • Thread starter Thread starter Shaul Feldman
  • Start date Start date
S

Shaul Feldman

Hello,
I'm almost sure it's possible, just how?! The breakpoints I put in JS code
(client side) are not doing anything when I run ASP.Net application (F5).
How this can be done?
 
Hi Shaul,

You are correct. It IS possible. However, it is not by any means the same
thing as debugging server-side code. You can't just set a breakpoint in
VS.Net. Here's what you have to do:

1. Enable client-side script debugging in Internet Explorer. This is done
using Tools|Internet Options|Advanced, and DE-selcting "Disable script
debugging". This by itself will cause IE to prompt you to debug when any
JavaScript error occurs.
2. To set a breakpoint, enter the text "debugger;" by itself on any line in
your JavaScript. When the line is hit by the browser, it will break, and
offer to open the script in VS.Net's debugger.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Shaul Feldman said:
Hello Kevin,
thanks a lot - you have just made my day (well, actually tomorrow :)
It worked great for me. I put the debugger; directive in onload even handler
and all breakpoints where working. What a fun! Now I can easily debug my
client-side scripts. BTW, the debugger, it's not in Intelisence, how come?
Thanks again!
That's correct the build in MS client side debugger does not have
Intellisense built in
(at least it does not appear reliably). If you are going to do some
involved JavaScript debugging,
the venkman debugger is hard to beat as it contains debug features like call
stack, watches, object hierarchy, breakpoints and more . If you are testing
your app with a recent copy of Netscape, chances are you already have the
developer tools, including the debugger already installed. It's much more
powerful than the MS debugger .
 
Hello Kevin,
thanks a lot - you have just made my day (well, actually tomorrow :)
It worked great for me. I put the debugger; directive in onload even handler
and all breakpoints where working. What a fun! Now I can easily debug my
client-side scripts. BTW, the debugger, it's not in Intelisence, how come?
Thanks again!
 
HI,
today at work I have tried the same and got something interesting.
I have inserted the debugger; statement, but forgot to remove V from
"disable JS debugging" - it actually worked! How come?
 
Back
Top