I want to be able to launch my packaged chrome app via javascript either on-page or through an extension. Am I able to do this? I have done a fair amount of research with no answer in either direction. Can somebody at least point me in the right direction?
Asked
Active
Viewed 8,009 times
3 Answers
5
chrome.management.launchApp
can be used to launch an app in an extension.
The API reference is available here: https://developer.chrome.com/extensions/management.html#method-launchApp.

方 觉
- 4,042
- 1
- 24
- 28
-
1This does not seem to work from a webpage. chrome.management is undefined. – Tomas M Mar 18 '15 at 13:59
3
You can make certain resources in your extension available, and then you should be able to "window.location" to that.
The URL scheme is chrome-extension://[PACKAGE ID]/[PATH]
.
Example:
//This is **not** in your packaged app, but in another web page
window.location = "chrome-extension://abdecbedphjijkaed/index.html";
In your packaged app, you'll need to declare which resources can be reached via a url in your manifest:
"web_accessible_resources": [
"images/my-awesome-image1.png",
"images/my-amazing-icon1.png",
"index.html"
]
See more: https://developer.chrome.com/extensions/manifest.html#web_accessible_resources
NOTE: This might not work. While the user can use "chrome://" urls, I'm not sure if web pages can

Don Rhummy
- 24,730
- 42
- 175
- 330
-
I want to launch a packaged app, not view an extension's resource. – nathanjosiah Jun 13 '13 at 22:13
-
packaged apps can be reached the same way. They're considered extensions in this regard. Did you try it? See if you can launch that page and if as a result your `onLaunched` is called. It might not be possible, but it might. – Don Rhummy Jun 13 '13 at 23:08
-
3I can't even install the package with that `web_accessible_resources` key in the manifest, it gives me the error of "'web_accessible_resources' is only allowed for extensions, hosted apps and legacy packaged apps, and this is a packaged app." – nathanjosiah Jun 13 '13 at 23:29
-
1No I am not and how can I be wrong, the browser gave me that message http://cl.ly/image/0f3n1S2E0o2N. Notice that it specifically says that I'm trying to use it with a packaged app. But it doesn't matter. Even if the property worked this would open a resource in the browser, not launch the app. Because of this, the page would not have access to all of the things that packaged apps normally have access to such as USB devices. – nathanjosiah Jun 14 '13 at 15:02
-
@nathanjosiah Ah, ok, here's how you fix that error: add "update_url" to your manifest and it becomes a hosted app. (It needs to be an actual ".crx" file) – Don Rhummy Jun 14 '13 at 18:57
-
1I could not get this to work even with that property. Like I said though, it doesn't matter. I need to access USB hardware which won't be allowed in the manner you are talking about. – nathanjosiah Jun 14 '13 at 21:15
3
This feature is coming. See Issue 111422: Add ability for apps to register for URL handling.

Vincent Scheib
- 17,142
- 9
- 61
- 77
-
I have seen that thread actually. Launching via URL scheme will be very useful but is there a way to do it via the Chrome API? – nathanjosiah Jun 13 '13 at 22:49