admin管理员组

文章数量:1410737

I would like to open a packaged chrome application automatically when the browser starts.
I have tried: chrome-extension://app id/
But it doesn't work. I get chrome-extension://invalid/ error page.

I would like to open a packaged chrome application automatically when the browser starts.
I have tried: chrome-extension://app id/
But it doesn't work. I get chrome-extension://invalid/ error page.

Share Improve this question asked Apr 14, 2016 at 0:44 E_bmeE_bme 892 silver badges6 bronze badges 4
  • chrome.management.launchApp(id) – Daniel Herr Commented Apr 14, 2016 at 1:12
  • where exactly would I run this? I can't include it in the app as it's a packaged app and management is not allowed – E_bme Commented Apr 14, 2016 at 1:23
  • If you control the app why dont you just open it normally? – Daniel Herr Commented Apr 14, 2016 at 1:24
  • End users can't be trusted to remember to run the app. So I want it to run as soon as the browser opens up. – E_bme Commented Apr 14, 2016 at 1:29
Add a ment  | 

1 Answer 1

Reset to default 7

Use the chrome.runtime.onStartup event, "Fired when a profile that has this extension installed first starts up".

chrome.runtime.onStartup.addListener(function() {
 chrome.app.window.create("main.html")
})

https://developer.chrome./extensions/runtime#event-onStartup

本文标签: javascriptLaunch chrome application on startupStack Overflow