Visual Studio code 'open in browser' extension failed - visual-studio-code

I have installed Open in browser visual studio extension. But when I try to open the browser by shortcut Alt+B. It fails showing the following:
Running the contributed
command:'extension.openInDefaultBrowser' failed.
Please help if there's any solution.

Go to settings --> Extensions --> Open in Browser and set a default browser. In my case I have set it to "chrome" (it can be "firefox" too), so it opens in chrome every time I use the extension.

i have no problem when i using windows, but since i use linux open in browser extension not work because default browser not set as well, and i try to set manual in VS Code setting and set the plugin open-in-browser by default to Firefox
its solving my problem i hope its work to you

If the above solution didn't work install its previous version
Vote up If this Helped !!

Related

How to make firefox developer edition as default browser for development [duplicate]

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.
Go to file-> preferences -> user settings -> search "By Default it will open your default favorite browser" set your browser.
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.
From the Tasks menu, Select 'Configure Tasks'
The entry field prompts you for 'Select a task to configure'
Choose 'Create tasks.json file from template'
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}"]
}
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.
Go to Settings -> Extensions -> Live Server Config -> Update Default 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.
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.
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).
search for local.testsettings on vscode on the search and for web tests, change the browser to chrome and apply.
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!
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.
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.
In my case changing the default browser in the system settings of my pc did it.
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
Click settings -> enter: default browser -> find: Open-in-browser:Default -> enter: Google Chrome
Google Chrome > Settings (left sidebar) > Default browser = Google Chrome
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.

Unable to open http links from Visual Studio Code: Your Firefox profile cannot be loaded

When I try to open a http-Link in Visual Studio Code, my standard browser Firefox is not able to open it. I receive a Firefox error message:
Your Firefox profile cannot be loaded. It may be missing or inaccessible.
How I reproduce this on my machine:
Create a document (test.txt), paste http://www.stackoverflow.com/ in it, hover over the link in VS Code and follow it via ctrl-click.
I am not sure if this a Firefox question or a VS Code question, or both. But opening links from other programs such as Thunderbird or LibreOffice Writer works.
If I go to ~/.mozilla/.firefox/ and delete the profiles.ini, Firefox creates a new profiles.ini with which links do open from VS Code. However, that way I lose my Firefox profile.
Versions:
Ubuntu 20.04 LTS
VS Code 1.68.1
Firefox 101.0.1
The problem was that Visual Studio Code always tried to open a different, non-existing profile than the one that Firefox uses. My profiles.ini in ~/.mozilla/ was not correctly configured. There was an entry
[Profile1]
Name=default
IsRelative=1
Path=ezn6ueee.default
Default=1
set as default which was pointing to a folder ezn6ueee.default which did not exist in the directory. I went in Firefox to about:profiles, deleted this profile and set the one which I was usually using as default.

Open in browser not working for visual studio code

I'm trying to use the open in browser extension (alt + b) for my visual studio code html, however it is not working even after attempting to uninstall and reinstall vsc again.
Extension id: techer.open-in-browser
Error code:
Open browser failed!! Please check if you have installed the browser chrome correctly!
Go to settings --> Extensions --> Open in Browser and set a default browser.(Chrome, for example)

Open Link in VSCode Will Create a New Web Browser Under Same Icon as VSCode

I am using VScode version 1.45 with Firefox version 76.0.1 as a default browser (with Ubuntu 18.04.4 LTS). Whenever I tried to open a link in the VSCode, it will open the Firefox browser under same icon as VSCode, and I cannot merge these tabs into existing Firefox web browser.
Same thing also happens when I try to run a program using live server extension. But when I use npm to start the development server, it will create a new window or tab under the Firefox icon.
How could I fix this so whenever I open a browser from VSCode, it will create a new browser or tab under the appropriate (Firefox) icon? Thank you.
There is already an issue on VSCode's GitHub repository and as it is mentioned in the issue, origin of the issue is in snapd.
To fix the issue, as mentioned on aforementioned github issue:
Open some URL from the VSCode snap.
In the new window, navigate to about:profiles.
Ensure that the profile marked as "Default Profile" matches Firefox when opened normally. If not, use the "Set as default profile" button under the correct profile to change the default.
Try making firefox your default browser thorugh firefox and also do check that firefox is your default browser from vscode
I found this solution the best solution
You might have installed VSCode as a snap package, which causes
$XDG_CACHE_HOME to be set to ~/snap/code/common/.cache, which could
cause some cli tools to mistake that for your cache directory, and
install/launch binaries from there.
If you install VSCode from the .deb download, it should fix your issue
I removed vscode from Ubuntu software and download the .deb file from vscode site and install it ... problem solved

JetBrains IDE Support Extension - How to disable Chrome Warnings?

Hey there I've been using the JetBrains IDE support extension for a week now, and While it is great utility. I grow tired of clicking the "X' in the Chrome Yellow Warning ("JetBrains IDE Support" is debugging this tab.)
This may be a noobish question for experienced devs, but does anyone knows how to get rid of this Chrome pop-ups?
Thanks :)
Here is a snapshot:
You can disable this warning in chrome://flags using the Enable Silent Debugging flag:
It's mentioned in the comment #28.
Here is the direct link to the option:
chrome://flags/#silent-debugger-extension-api Just paste this to your Chrome addressbar.
For the ones who didn't understand ( like me :P )
You need to open this address chrome://flags in Google-Chrome and Enable Silent Debugging
While the relevant flag has been removed from chrome://flags, you can still use the command line switch:
chrome --silent-debugger-extension-api
which can be persisted in your flags config (eg. ~/.config/chrome-flags.conf on linux).
See Enable Silent Debugging is not available in Chrome browser
For the newer versions of the Chrome this flag is not available anymore.
So Here is the solution
Open settings in your IDE then head into Tools>Web Browsers
then click on Chrome and hit the pencil icon and
write this in "command line options" finaly hit ok
--silent-debugger-extension-api
now close your chrome if it is open then try to launch it again using debug or run...