Karel Bílek
Karel Bílek

Reputation: 37734

Open a website in new tab when clicking on Chrome App icon

I am developing a Chrome App/Extension.

Technically, it's a Chrome App, since only apps have access to Chrome USB API, and I need that. However, in reality, it works more like a Chrome Extension, since I allow specific websites to send messages through message passing, and the app has no window for itself and runs in a background page.

Now I have an "App", that for all intents and purposes works as an extension. After install, however, an icon of this "non-App App" is installed in App launcher, where it does nothing and confuses the user. The nice solution would be to open a new website in a new Chrome tab after clicking on the icon that explains things.

However, I cannot find out if it's even possible. I can open a new "chrome-less" window and put the website there, but I don't want that.

Upvotes: 1

Views: 140

Answers (1)

Daniel Herr
Daniel Herr

Reputation: 20508

You can use chrome.browser.openTab({ url: "whatever"}), with the "browser" permission. This is new in Chrome stable 42, so you might want to add "minimum_chrome_version": "42" to your manifest.

Upvotes: 2

Related Questions