How to debug (only) JavaScript in Visual Studio? - javascript

I'm developing a webapplication (asp.net mvc 4) with Microsoft Visual Studio 2012, and as the solution is getting bigger, the debug is getting slower.
Need to know if there is a way to debug only my client side (javascript) on visual studio instead of the entire application (server+client).
Is there any way to attach to process of IE and get the breakpoints working ....?
Not interested on get the debugger running on entire client/server application, just client.

First open Visual studio ..select your project in solution explorer..Right click and choose option "browse with" then set IE as default browser.
Now open IE ..go to
Tools >> Internet option >> Advance>> uncheck the checkbox having "Disable Script Debugging (Internet Explorer). and then click Apply and OK and you are done ..
Now you can set breakpoints in your JS file and then hit the debug button in VS..
EDIT:- For asp.net web application right click on the page which is your startup page(say default.aspx) and perform the same steps. :)

Yes you can put the break-point on client side page in Visual studio
First Put the debugger in java-script code and run the page in browser
debugger
After that open your page in browser and view the inspect element you see the following view

The debugger should automatically attach to the browser with Visual Studio 2012. You can use the debugger keyword to halt at a certain point in the application or use the breakpoints directly inside VS.
You can also detatch the default debugger in Visual Studio and use the Developer Tools which come pre loaded with Internet Explorer or FireBug etc.
To do this goto Visual Studio -> Debug -> Detatch All and then click Start debugging in Internet Explorer. You can then set breakpoints at this level.

For debugging JavaScript code in VS2015, there is no need for
Enabling script debugging in IE Options -> Advanced tab
Writing debugger statement in JavaScript code
Attaching IE didn't work, but here is a workaround.
Select IE
and press F5. This will attach both worker process and IE as shown here-
If you are not interested in debugging server code, detach it from Processes window.
You will still face the slowness when you press F5 and all your server code compiles and loads up in VS. Note that you can detach and attach again the IE instance launched from VS. JavaScript breakpoints are hit the same way they are in server side code.

It is possible to debug by writing key word "debugger" to place where you want to debug and just press F5 key to debug JavaScript code.
http://www.aspsnippets.com/Articles/Debug-JavaScript-and-jQuery-using-Visual-Studio-in-Internet-Explorer-browser.aspx

This is what worked for me:
Add a new browser with to ie x86 version
2- On the Start Options of the Property Pages select the Start Option as:
Don't open a page. Wait for a request from an external application
3- Open the application from internet explorer
4- In the attach to Process screen select the following code types:
Javascript (Microsoft edge - chromium) and Script
5 - In the available process list select:
iexplorer.exe x86

Related

Cannot disable Javascript Debugging in Visual Studio 2013?

I am building an ASP.NET Web Forms application (not site) and whenever I debug with Internet Explorer, I cannot seem to disable the integrated Javascript debugging with Visual Studio 2013 Pro.
How do I get it to stop breaking on Javascript exceptions?
My OS is Windows 2012 Server R2 (so, equivalent to Windows 8.1 Pro) with IE11. I have tried every setting that I could find but nothing has worked so far. I have even logged out and back in. I am going to try a complete reboot right now.
The screenshots below show all the settings I've tried.
Exception and Settings:
Visual Studio Options - Debugging:
Internet Explorer Options:
BrowserLink Disabled
If you run your web project with IE, VS will automatically attach to the IE process and debug it and there is no way to disable that.
So, start debugging with Chrome or Firefox if you don't want VS to debug IE automatically when you run your project. Then open up IE and navigate to your site if you still need to test with IE.
There is no user-unhandled column on yours Exceptions window, if its hide make it appear and uncheck all check marks. See:

Chrome blocking javascript on localhost

I'm working on developing a site on my local machine (Windows 7 Ultimate x64) using WAMP, running APACHE v2.2.22, PHP 5.3.13, and MySQL v5.5.24. I'm developing using Chrome v 22.0.1229.94. I've got quite a bit of javascript in the site, however, and Chrome is relentlessly blocking javascript from running on the page.
Clicking on the little 'blocked javascript on this page' icon in the address bar includes the dropdown that has "Always allow Javascript on Localhost" checked off, and I also have a JavaScript exception in Chrome's settings explicitly saying to always allow JavaScript on 'http://localhost'.
Cookies are being allowed, "Allow all sites to run JavaScript" is checked off, and I have no idea as to why Chrome is not allowing the JavaScript to run.
Overall, it's not imperative to the project that I figure out a fix as both IE9 and Firefox 16.1 are allowing JavaScript and I can utilize them. I am simply curious if there's anything I can do to fix this in Chrome, as I would like to continue developing in Chrome.
If you notice that JavaScript is only blocked when the console is open (as some are saying), chances are that you disabled JavaScript in the console settings.
Open the console.
Click the vertical ellipsis icon (or the gear icon on older versions) in the upper right and go to settings.
See if the "Disable JavaScript" checkbox is checked.
I have the same issue, but only when the console is open. When the console is closed, JavaScript loads fine on localhost. Makes it hard to debug things though....
I got around it by opening localhost in an incognito window.
You can give your local server a domain name, may be that would help.
Open C:\Windows\System32\drivers\etc\hosts in notepad
Edit that file add a new line at the end
127.0.0.1 mydomain.com
Save, now goto chrome and type in http://mydomain.com/ this should point to your local server.
Since you nolonger run on "localhost" may be chrome will let you pass.
Let's me know if that works. Good luck!

Why won't Visual Web Developer act as my Javascript debugger for IE7?

I need to debug some JS that isn't working in IE7, so I installed Visual Web Developer 2010 Express into my IE7 virtual machine, with the intention of using it to debug whatever I want. But when I get a Javascript error in IE7, I only get the generic "problems with this website" message, and no debugger:
"Disable script debugging" is off in Internet Options and "Display a notification about every script error" is on. I have tried resetting the default settings for both IE and Visual Web Developer, and disabling all add-ons for IE.
Anybody know what gives?
Make sure your default browser is set to the browser you're trying to test against (in this case, IE 7). When you start debugging your empty project in Visual Wed Developer, it should open the default browser.
Not sure about the nature of it, but some magic happens behind the scenes that enables the script engine in IE to be exposed to the developer through the IDE.

JavaScript debugging in VS2008

I'm having a real problem trying to attach the JavaScript debugger in VS2008 to a web project. The web app is an ASP.NET MVC project but I don't think that should matter.
I'm using jQuery and have a .js file loaded when the page loads and in this .js file I call $(document).ready(function() { ... } and do some stuff and this "works." When I set a breakpoint it becomes disabled when I run the project through Cassini with the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."
This error message is somewhat confusing because this is a javascript file so I would expect it to have a symbols file that could be loaded. i.e. a .pdb file that you would need to debug server side code. Or am I missing something here?
I found this post here:
Using breakpoints to debug Javascript in IE and VS2008
but that didn't help.
I've also tried a few other recommendations which involved attaching the browser from the debug menu after starting the debug session and I've tried doing this on IE x86, IE x64, and Firefox. If I add "debugger;" to my code then it will break in Firefox and let me step through the code in the Firefox debugger but I can't get it to do this in VS2008.
I'm running Win7 x64 Ultimate with VS2008 and the project is ASP.NET MVC with jQuery.
Any ideas?
have you tried debug the js file alone(put a debugger in code) by adding it to a blank html page?? and check whether it ll throw a script breakpoint exception and allow you to attach to VS 2008??
Have you checked the "enable script debugging" option under tools (not sure what it's called, on a Mac right now) in IE?

Javascript debugger issue in VS2008

I'm having a really annoying problem with debugging javascript with VS2008.
If I simply press F5 (or choose 'start Debugging' from the Debug menu), the iexplore process is attached, but no breakpoints break in the scripts. The Script Documents tree doesn't even appear in the solution explorer.
I already know:
I can set a breakpoint in Javascript just fine. It does NOT show the "This point will not be hit" message.
Calling the debugger through using the 'debugger' keyword works fine, but attaching to the iexplore process doesn't since it gives a "process already attached to a debugger" message.
Using the manual 'Attach to process...' works just fine. The Script Documents appears as well.
The project has recently been converted to a Web Application from a WebSite.
I already tried:
Clearing the IE cache.
Shutting down VS2008, Stopping the IIS and deleting the temporary asp.NET files restarting both IIS and VS2008 afterwards.
Setting IE7 as the default browser both for windows and for VS2008.
Resetting my user settings for VS2008.
Checking that IE script debugging is enabled.
Nothing has worked so far. While Attaching to process isn't too taxing, it is very annoying when I'm used to just hitting F5.
If anyone can think of a solution, please please please (I'm begging here!) let me know!
Is silverlight debugging enabled on the website project properties? This will disable Javascript debugging.

Categories

Resources