I\'ve built a chrome packaged app, and I\'m trying to make one of the buttons in it open the chrome browser in a specific link.
For this, I used window.open(\"
This only happens from inside the app window.
If you call window.open
from the background page, it will open in Chrome.
So, send it to your background page:
// app window
function openInChrome(url) {
chrome.runtime.sendMessage({action: "openURL", url: url});
}
// background
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if(message.action == "openURL") window.open(message.url);
});
Use chrome.browser.openTab
. See issue. At the moment it's in dev channel.