Sergio Garcia Murillo
Sergio Garcia Murillo

Reputation: 11

How to open a popup window with an external url in a chrome app? (like window.open with _blank)

I need to open an url on a new and single tab chrome window, as you would normally do with window.open and "_blank", but when done inside a chrome app, the url is opened in a new tab of an already running chrome, ignoring all the window features options (width, height, etc).

Are we doing something wrong or is this a chrome app constrain? Any way to solve it?

Best regards Sergio

Upvotes: 0

Views: 1377

Answers (1)

Xan
Xan

Reputation: 77561

You have two options.

  1. Use a proper API to open a tab, chrome.browser.openTab, but that doesn't give you an ability to open it in a separate window. Such an option would probably be a nice addition, you can try submitting a feature request for it.

  2. Open an app window with a local HTML file that embeds the required web content inside a <webview>. You then have full control over appearance, but lose access to browser's conveniences like cookie/password store of the current user, and have to implement some things yourself like dialog boxes.

I'm afraid a Chrome app cannot interact with the browser itself in a more detailed way by design.

Upvotes: 1

Related Questions