Xander Bielby
Xander Bielby

Reputation: 181

Chrome OS vscode:// and other links not opening, gives "Google Chrome OS can't open this page"

So I've already solved this problem, but it was so frustrating I wanted to make sure there was a post about it for people in the future.

The issue comes from Chrome OS's browser, because it does not support links that open apps in linux, such as vscode://. On linux systems, such as the ubuntu container used to install linux apps on Chrome OS, opening links is handled by xdg-open, which starts the browser/associated programs.

On Chrome OS however, this doesn't happen. Because it is not linux, and does not rely on the linux filesystem, the normal system for registering alternate URL protocol handlers does not function. This means that vscode:// and other such links don't work.

Upvotes: 1

Views: 2441

Answers (2)

Dhushyanth
Dhushyanth

Reputation: 63

I tried the method with simplenote on Lenovo Duet, but it did not work, it just kept on saying no URL handler. It might have been due to it being only available as an app image for arm64 architecture.

Anyways I solved it by installing another browser on Linux, Example:

sudo apt install firefox-esr

Browsers installed by this method are then made the default browser for links opened from linux, and also easily picks up the url-schemes since it also runs from the same partition.

Note: This is just a workaround as installing another browser kinda goes against the entire chome-os ideals but it always comes in handy while dealing with Linux apps.

Upvotes: 1

Xander Bielby
Xander Bielby

Reputation: 181

Solution

This is more of a workaround than a permanent solution, but will work:

xdg-open <url>

Usage

It may not be immediately clear on exactly how to use xdg-open with your links, or even how to get links. I found this problem when logging into VSCode live share using microsoft. What you have to do is quite simple:

  1. Inspect the page
  2. Go to Network or equivalent
  3. Click Continue
  4. Right click the new request sent
  5. Copy address
  6. Open up terminal
  7. Write xdg open
  8. Paste your link, making sure to put "" quotation marks around it, because they often contain the & character, which is significant in bash.
  9. Enjoy

Explanation

It was a problem not well documented, because few people try to run VSCode on Chrome OS. The root of the problem, as I said, comes from the browser not being linked to anything else.

The heart of protocol handlers rests in this directory:

~ 
❯ ls ~/.local/share/applications/
mimeinfo.cache         vsls-launcher.desktop  

vsls-launcher.desktop contains the data necessary for xdg-open to launch vscode with vscode:// links.

My first hints came from this reddit thread, u/kgjv's comment in particular: https://www.reddit.com/r/Crostini/comments/chizyk/crostini_how_to_make_linux_apps_open_links_in/

It says how xdg-open will launch chrome from linux, so I did a little more digging and found ~/.local/share/applications/ to contain the configuration.

Any apps that support this will have their own .desktops, so you need only copy the link and launch it with xdg open

Upvotes: 2

Related Questions