I am setting up my VS Code environment for the first time, but I can\'t figure out how to set Chrome as the default browser for the workspace.
Chrome can be launched by way of debugging your application. Within launch.json, the configurations[].serverReadyAction.action
configuration was given a possible value of debugWithChrome
in the VS Code February 2019 release. Note that this will also require you have the Debugger for Chrome extension installed. You will not receive a warning if the extension is not installed and you've configured launch.json to use debugWithChrome
.
Note: Configuring launch.json with debugWithChrome
will work even if you launch using CTRL+F5 to run the app without debugging.
The other StackOverflow questions regarding the browser, had to do with opening a specific file. Here are the steps to creating a tasks.json file in a brand new environment.
{
"version": "0.1.0",
"command": "Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"args": ["${file}"]
}
Go to file-> preferences -> user settings -> search "By Default it will open your default favorite browser" set your browser.
This Alternate Way helped me:)
GoTo-->Google Chrome-->Settings-->Default browser-->Set Google Chrome as default browser
The method of modifying tasks.json no longer works in newer versions of Visual Studio Code. The easiest way to be able to launch your code in a browser is to install the Open in Browser extension from the marketplace.
After it is installed and VS Code is reloaded, you can go to your code and press ALT + B to launch your application in your default browser or ALT + SHIFT + B to select the browser you want to use.
You can also right click and select these option from a drop down menu, but I mention this last because this currently does not work in some versions of VS Code.
You can adjust settings in your computer to open.HTML file extensions in chrome as a default browser: for Example in PC windows:
go to Control Panel > Default programs > Associate a file type or protocol with a specific programs >HTML extension and choose Chrome.