I'd like to use new APIs provided for Chrome Packaged Apps, but also want to preserve ability to open some local URL in my current browser environment, is it possible? All Packaged Apps tutorials are focused on creating separate window and using app as first class citizen in the system.
Maybe its possible somehow to use chrome.socket
and other APIs as usual, probably even only in developer mode?
For this, you have to hold the CTRL button and then click on the left mouse button while pointing the cursor to the web address. If you click on a link in this manner, the website won't open in your current tab; instead, you'll see a new tab with your preferred web page.
No, it is not possible by design. Chrome packaged apps run separately from the browser and have no access to browser-specific features, like tabs. The closest you can get is to open an external (not in the packaged app) URL in the browser through window.open.
However, you can kind of emulate a browser by using the webview tag. See the code of the Browser sample to learn how to do it.
You can also install an extension that talks to your packaged app using the just released messaging API. See the messaging sample to learn how - it is pretty simple as long as you know the app and the extension IDs.
Edit: this is unsupported/likely to break in Chrome 44/45+ or so. There was around March 3rd a code review which does indeed break window.open from background page, but was reverted temporarily. So expect this to not work starting around Chrome 50?
It actually is possible (in Chrome 43) to run your chrome platform packaged app in a browser tab. From your background page, simply call window.open
with a URL of some content in your app. for example if index.html
is in your app's directory, it will open your app in a browser tab with URL chrome-extension://{{ extension id }}/index.html
This should not require any extra manifest permissions.
Note that it will not work if you simply type the url chrome-extension://{{ extension id }}/index.html
into your browser. You need to open it from the app's background script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With