How do I set the default browser as chrome in Visual Studio Code?

后端 未结 8 1436
遥遥无期
遥遥无期 2020-12-06 09:20

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.

相关标签:
8条回答
  • 2020-12-06 09:43

    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.

    0 讨论(0)
  • 2020-12-06 09:46

    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}"]
    }
    
    0 讨论(0)
  • 2020-12-06 09:51

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

    0 讨论(0)
  • 2020-12-06 09:53

    This Alternate Way helped me:)

    GoTo-->Google Chrome-->Settings-->Default browser-->Set Google Chrome as default browser
    
    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-06 10:01

    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.

    0 讨论(0)
提交回复
热议问题