79

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.

Gama11
  • 31,714
  • 9
  • 78
  • 100
Su Llewellyn
  • 2,660
  • 2
  • 19
  • 33

17 Answers17

24

Go to file-> preferences -> user settings -> search "By Default it will open your default favorite browser" set your browser.

preety
  • 309
  • 2
  • 4
  • 66
    This no longer appears to be accurate (ver. 1.41.1) – Ryan Jan 07 '20 at 03:12
  • code -> preferences -> settings -> search "By Default it will open your default favorite browser" or just "browser". works for me on version: 1.48.2 – j roc Sep 07 '20 at 18:53
  • 1
    In mine vsCode version - 1.49.0, I've placed 'browser' in search and it shows me the field where I can type prefered brouser. – Kiril Dobrev Sep 21 '20 at 10:57
  • 24
    in ver 1.63.2 searching for "browser" does not display this configuration – neves Feb 04 '22 at 16:09
  • This is a Live Server extension setting. It won't exist is you haven't installed Live Server (`ritwickdey.liveserver`). – Merchako Apr 07 '23 at 16:20
12

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.

  1. From the Tasks menu, Select 'Configure Tasks'
  2. The entry field prompts you for 'Select a task to configure'
  3. Choose 'Create tasks.json file from template'
  4. Edit the file to include the following block:

{
            "version": "0.1.0",
            "command": "Chrome",
            "windows": {
                "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
            },
            "args": ["${file}"]
}
ruffin
  • 16,507
  • 9
  • 88
  • 138
Su Llewellyn
  • 2,660
  • 2
  • 19
  • 33
9

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.

RobC
  • 22,977
  • 20
  • 73
  • 80
Jasel
  • 535
  • 8
  • 14
  • Oops. `The pattern is only matched in the Debug Console. It doesn't yet work if the debug target is launched in the Integrated Terminal (and it will never work in external terminals).` and `The feature does not warn if debugWithChrome is configured but the Debugger for Chrome extension is not installed.` Am I the only person to launch my node servers from integrated terminal? Also, Debugger for Chrome seems a bit erratic. Check your VSCode notifications (little bell icon, bottom right) – zipzit Feb 24 '20 at 20:23
  • I'm stuck here at launching my react app via `npm start`, then `launch chrome against localhost`. App works fine on Chrome, but debugger opens up MS Edge for the debugging. Not so good, I've been using Chrome dev tools for too long. Anybody else? – zipzit Feb 24 '20 at 20:27
  • This currently works in 2022 and the Debugger For Chrome extension is no longer required. – Neutrino Mar 23 '22 at 13:30
5

Go to Settings -> Extensions -> Live Server Config -> Update Default Browser:

enter image description here

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Meghna Lohani
  • 77
  • 1
  • 1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/26869824) – sɐunıɔןɐqɐp Aug 06 '20 at 08:41
  • @sɐunıɔןɐqɐp The 'link' was to an image (which I've now embedded). – Adrian Mole Aug 06 '20 at 08:49
  • no good for debugging, unfortunately, VSCode keeps going to default Windows browser instead of what you set here! – MC9000 Jun 23 '21 at 02:17
4

This Alternate Way helped me:)

GoTo-->Google Chrome-->Settings-->Default browser-->Set Google Chrome as default browser
shyam
  • 1,084
  • 12
  • 20
  • 43
    This changes the default browser system wide. Not at VS Code level. – María Arias de Reyna Domínguez Dec 17 '19 at 08:10
  • 1
    Well, after trying others solutions, which didn't work or I couldn't even find settings with "browser" tag in VS Code, finally I just tried this easy one and, unbelievable, it helped! I thought that Google is my default browser in system, but it didn't. This little, simple solution works great. – Kida May 31 '21 at 07:02
  • And my browser was already set to Firefox, at the system level, but I couldn't get VS Code to stop starting Chrome – Auspex Jul 13 '21 at 14:39
  • Tried everything else and this was the solution (even after setting the default browser to Chrome in Windows) -- perhaps because I had Chrome open already – Sludge Apr 22 '22 at 23:39
  • Yep, this was the way. – Tony Gutierrez Jul 12 '22 at 15:08
3

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.

Justin
  • 707
  • 7
  • 13
1

Just a helper for the windows users, I just installed windows 10 again and I was wondering how do I set my vscode to open the server (web) using chrome instead of edge, so to do that you just have to configure your windows to use google chrome as default, you don't need to change anything in vscode, I hope this helps someone.

ps: normally you can go open browser you want to be default and setup the configuration. so in chrome you have to go to configurations and scroll down to default browser.

1

When you want to use your own browser using "Open with Live Server" without change OS globally configuration.

In Windows, Visual Studio Code (ver. 1.70.1 (July 2022)). Go to "File" > "Preferences" > "Settings"

Then select a tab, "User" tab if you want your desired browser for all your projects, or select "Workspace" tab or "ProjectName" tab for especified projects.

Then go to "Extensions" > "Live Server Config" > "Settings: Custom Browser" finally change the 'null' value selecting the browser of your preference from the list (apparently this list depends on installed browsers but i'm not sure).

sebang
  • 11
  • 1
0

search for local.testsettings on vscode on the search and for web tests, change the browser to chrome and apply.

55s25
  • 11
  • 2
0

The Live Server extension was not appearing for me on settings. However, I installed Open in Browser and typed "liveServer.settings.CustomBrowser" in settings and the extension appeared with a dropdown box in which I was able to change the default browser.

Hope this helps!

0

This may be old but I found something that could help.

First go to Settings/Apps/Default Apps. Set your browser as default.

Next go to VSCODE and go to File/Preferences/Settings/Extensions/LiveServerConfig

Then scroll to settings: CustomBrowser Change it to your custom browser

Note- If the browsers don't show up on VSCODE then you need to set it to default in the settings.

-1

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.

-1

In my case changing the default browser in the system settings of my pc did it.

Arthur
  • 1
-1

None of the above works in my case(my version is August 2022 1.71) to make it work I went straight to **

  • File-->Preferences-->Settings-->Extensions-->Plugin open-in browser

** from there was a option which says Default set browser so I choose Brave as there is no ads in it while playing the video as chrome plays ads so for getting a proper feeling of using my self made Jarvis I used Brave.

Thanks

-3

Click settings -> enter: default browser -> find: Open-in-browser:Default -> enter: Google Chrome

Min Guo
  • 415
  • 1
  • 4
  • 6
  • 3
    There are no settings with the word "browser" let alone "default browser". – Taylan Jul 02 '20 at 11:44
  • @Taylan, there is *after* you add the 'Open in Browser' extension by 'TechER'. Here's a 2-minute video that shows how: https://www.youtube.com/watch?v=T8DrI6K8ArE I used the latest version that i found (version 2.0), by the same developer. (The video shows an earlier version.) Then follow Min Guo's advice above. (I set mine to 'FireFox', not Chrome tho, because i don't have Chrome installed on this computer. And now VS Code opens it in FireFox perfectly for me, while still allowing my OS to have a different default browser [Chromium] which does not load correctly from this extension.) – Shawn Kovac Jul 24 '20 at 03:00
-5

Google Chrome > Settings (left sidebar) > Default browser = Google Chrome

Google Chrome > Settings (left sidebar) > Default browser = Google Chrome

4b0
  • 21,981
  • 30
  • 95
  • 142
Ashwin
  • 1
-5

Just change your default web browser in your OS. In Windows 10, you can search "default browser" then the wizard for changing it, will be appear.

  • This doesn't answer the question. Many developers use one browser for development work (like Chrome) and one for day-to-day web browsing (like Firefox). OP specifically asks 'for the workspace' which indicates they want to limit its usage to that, not set it as the OS default. – Ian Paschal Oct 06 '21 at 13:54