Pete
Pete

Reputation: 10871

Debug JavaScript in Visual Studio 2010?

Currently I am debugging my JavaScript using Firebug for Firefox. Is there anyway to debug javascript in Visual Studio 2010? The JavaScript isn't part of any Visual Studio project, it's just a .js file that will be linked to a static HTML page (it's to debug school assignments).

I did try searching and the results weren't any more recent than around a year ago. I'm hoping something has changed or there is a better workflow than notepad++ for HTML/JavaScript and Firebug for debugging.

Upvotes: 31

Views: 69500

Answers (7)

gdbdable
gdbdable

Reputation: 4501

To use debug in Internet Explorer, you need perform these steps:

  • enable script debugging in IE (go to Internet options->advanced->browsing and uncheck 'Disable script debugging')
  • select view->external script debugger->break on next statement

When next javascript statement will be reached, IE will show standard windows debugger selection dialog, when you can select instance of visual studio.

Update: With visual studio you can attach to browser process(e.g. iexplore.exe) and then debug

Upvotes: 16

Zymotik
Zymotik

Reputation: 7307

If you installed VS 2012 and then uninstalled it, you may need to Re-Install Visual Studio 2010.

Error you may get when trying to debug JavaScript:

---------------------------
Microsoft Visual Studio
---------------------------
Unable to attach to the crashing process. The correct version of pdm.dll is not registered. Repair your Visual Studio 2010 installation, or run 'regsvr32.exe "%CommonProgramFiles%\Microsoft Shared\VS7Debug\pdm.dll"'.
---------------------------
OK   
---------------------------

Upvotes: 1

Pete
Pete

Reputation: 10871

This question gets a lot of views so for the sake of completeness I just wanted to mention that I've been using Chrome Developer Tools for a while now. It's been working great for me and is what I recommend now when people ask me this same question.

Upvotes: 6

airbai
airbai

Reputation: 3966

Use the JavaScript debugger keyword in IE.

function onClickRow(detailUrl) {
    debugger;
}

When run your page in IE, a debug window will pop up, then select Visual Studio 11.

Upvotes: 36

Snake Eyes
Snake Eyes

Reputation: 16754

disable option from Internet Options like here : http://www.mayanksrivastava.com/2010/02/debugging-java-script-in-visual-studio.html

Upvotes: 1

Lynn Crumbling
Lynn Crumbling

Reputation: 13357

If you want to try giving it a shot in IE, I posted about using the js debugger here: jQuery/Ajax content not appearing/loading in Explorer

Upvotes: 0

user578895
user578895

Reputation:

Yes, but only in IE. Basically just create a web-page project and hit run. It'll launch IE in debugger mode.

Upvotes: 3

Related Questions