10

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?

5 Answers 5

6

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

4

I had the exact same problem. What worked for me was creating the Chrome (Brave) App using the same process and going to the Shortcut's profile. Can be found in (C:\Users<account>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Brave Apps) In that shortcut, I go to properties and in the target, instead of --app-id="". I change it to --app="<URL>". And now it will open my custom URL in the new window like an app (with no address bar and no toolbar).

2
  • Thank you this was the only solution that worked for me on Linux
    – Dan Ortega
    Commented Feb 9, 2023 at 2:45
  • That worked and seems the right solution for Windows (11) as well. Imho, if you think you have to use JS, you're going about it the wrong way.
    – tobibeer
    Commented Dec 22, 2023 at 9:04
3

Run JS similar to this before creating shortcut:

const startUrl = 'https://calendar.google.com/calendar/u/1/r';
document.head
  .querySelector(':first-child')
  .insertAdjacentHTML(
    'beforebegin',
    `<link rel="manifest" href='data:application/manifest+json,{"start_url":"${startUrl}"}' />`,
  );

or see alternatives here

https://apple.stackexchange.com/questions/390799/how-to-change-the-url-of-a-chrome-app-shortcut/399458#399458

1
  • Even when I used this solution succesfully for gmail, curiosly for calendar is returning me a TrustedHTML error
    – Tito Leiva
    Commented Aug 23, 2023 at 14:38
2

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).

1
  • 1
    There's no folder with the app id in the extensions. Just the icon folders in a different location.
    – Tito Leiva
    Commented Aug 23, 2023 at 14:07
2

You can use --app-launch-url-for-shortcuts-menu-item to use a custom url.

E.g., after --app-id=xxx, add --app-launch-url-for-shortcuts-menu-item="https://teams.microsoft.com/_#/".

As explained by this stackoverflow answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .