Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to attach VS Code Debugger to Internet Explorer 11 for JavaScript/HTML

I am trying to add a debug configuration that will allow me debug a normal JavaScript application. There is no server-side code or server, just a .html file with vanilla JavaScript.

I would like to be able to use the VS Code debugger, breakpoints, etc. and preview in Internet Explorer 11 by simply pressing F5.

I was able to get my launch.json configuration to run Chrome, but it doesn't seem attach to the process the same way that normal Visual Studio does. I would like to know how to do this with iexplore.exe:

            {
                "version": "0.2.0",
                "configurations": [
                    {
                        "type": "chrome",
                        "request": "launch",
                        "name": "Launch Chrome against localhost",
                        "url": "${file}",
                        "webRoot": "${workspaceRoot}"
                    }
                ]
            }

I cannot find any documentation for how to set these values. Everything I've found talks about nodejs. I don't use Node. I'm also not interested in downloading extensions because this is basic stuff and should be configurable being these are both Microsoft products. I'm sure someone has solved this already.

like image 256
eliteproxy Avatar asked Jul 21 '17 15:07

eliteproxy


People also ask

How do I enable JavaScript debugging in Visual Studio Code?

Open the extensions view (ctrl+shift+x) and search for @builtin @id:ms-vscode. js-debug. Right click on the JavaScript Debugger extension and select Switch to Pre-Release Version . Reload VS Code.

How do I debug HTML code in Visual Studio?

The simplest way to debug a webpage is through the Debug: Open Link command found in the Command Palette (Ctrl+Shift+P). When you run this command, you'll be prompted for a URL to open, and the debugger will be attached. If your default browser is Edge, VS Code will use it to open the page.

How does debugger attach to VS Code?

Simply click the cog icon to open the json file. Here you will see configurations for your setup. name refers to the option inside the debug dropdownlist. processName is the process name to attach to.


1 Answers

The reason you're able to attach to Chrome is that you have a debugger extension installed. There are extensions for Chrome, Firefox, and Edge, but not IE.

If you'd like to use a JavaScript debugger for IE you'll have to install Visual Studio instead. The Community Edition is free if you meet the criteria (personal use, or corporate for learning purposes only).

like image 188
Graham Avatar answered Sep 19 '22 16:09

Graham