Set custom URL for Chrome / Chromium Desktop App

You can create Chrome Apps that open a website in an own clean window, without all the browser controls as if it's a standalone app of the website by opening the desired website and then do:

-> More tools -> Create shortcut... -> Check ☑ Open as Window

However this will use the current URL and you can't specify a custom URL.

In my case I want to add the Microsoft Teams web version as Chrome App but after the login teams directly redirects to the last conversation.

So instead of https://teams.microsoft.com/_#/ the URL is something like https://teams.microsoft.com/_#/conversations/General?threadId=19:[email protected]&ctx=channel which will then be used as Chrome App URL.

This is undesirable since I don't want a specific (old) conversation to be the default.

Is there any way to set a custom URL for a Chrome App?


Solution 1:

Chrome creates a new extension for each App in the Extensions folder located in your current profile.
You can find that folder by opening chrome://version/ and look at the Profile Path entry.

In the Extensions folder you find different folders for each extension/app. Look up the correct app id by opening the settings of your app launcher on your desktop and inspect the command. The --app-id= will tell you the folder name.

For example: /usr/bin/chromium --profile-directory=Default --app-id=ioadaoddehcpmmmfbhcllmpknanfnena

Open Extensions/<app-id>/xxxx.x.xx.xxxxx_0/manifest.json:

{
   "app": {
      "display_mode": "browser",
      "icon_color": "#4C53BC",
      "launch": {
         "web_url": "https://teams.microsoft.com/_#/"
      },
    ...
   "manifest_version": 2
}

Edit the "web_url" entry and set it to your desired/shortened URL.
Also add an additional "manifest_version": 2 element (make sure the JSON is valid, if you add it as last element add a comma to the previous one).

In order to actually make the change effective you have to load the app again.

Open chrome://extensions/ and toggle the Developer mode in the top right corner.
Then click Load unpacked and load the folder containing the manifest.json you have just edited (folder with the format xxxx.x.xx.xxxxx_0).

Solution 2:

The best way I've found to do this is to change the URL before even making the shortcut.

You can do this using Chrome Devtools and the history object in the console.

For instance, say I wanted a shortcut to https://www.messenger.com. The problem is that when I'm signed into Messenger, that exact URL always forwards to a URL associated with my top chat.

In Chrome Devtools, I can paste in history.pushState({}, "", "/"), and the URL will change to just https://www.messenger.com. I can then make a Chrome Shortcut and it'll use that URL.

You can change the third parameter to make the URL anything you want, relative to the domain name. For example, history.pushState({}, "", "/t/threadname") will make the Chrome shortcut be https://www.messenger.com/t/threadname