Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Chrome App from web link

I'm trying to create just a simple html link to open a Chrome app when clicking it. Lets use the following example:

I have installed the app found at https://chrome.google.com/webstore/detail/videostream-for-google-ch/cnciopoikihiagdjbjpnocolokfelagl

If I open the app from the Chrome menus, it will open the app in a new browser tab, displaying chrome-extension://cnciopoikihiagdjbjpnocolokfelagl/app.html as the URL in the address field.

So, naively I thought that I could just specify that URL to make it open if the link is clicked, i.e:

<a href="chrome-extension://cnciopoikihiagdjbjpnocolokfelagl/app.html">Link to the installed Chrome App</a>

But that does not work. How should I do to link correctly to the (installed) app?

like image 526
AxelPaxel Avatar asked Dec 18 '14 15:12

AxelPaxel


1 Answers

If you were in control of the app in question, you could use externally_connectable property and listen for requests to launch your app.

But it seems like you don't control that app. Normal webpage code is unprivileged and cannot call chrome-extension:// URLs and the like.

You could potentially make a launcher extension. Using the management API you can launch the app with

chrome.management.launchApp("cnciopoikihiagdjbjpnocolokfelagl");

and that can, again, be triggered via web-to-extension messaging using externally_connectable. But that obviously requires that your users have two distinct Chrome add-ons installed, the app in question and your launcher shim.

like image 101
Xan Avatar answered Sep 28 '22 09:09

Xan