Zarkonnen
Zarkonnen

Reputation: 22478

Opening permanent window from chrome extension

I'm developing a Chrome extension (the Chrome version of Selenium Builder) which needs to create a permanently open window for the extension's UI. I've tried using the following code in a browser action popup:

document.addEventListener('DOMContentLoaded', function () {
  chrome.windows.create({url: "gui.html", width: 500, height: 600});
  close();
});

This works, except that the created window appears behind the existing windows. This may be related to this Chrome bug.

Is there a sane way of opening a permanent window and making it appear in front? focus() and chrome.windows.update(w.id, { focused: true }) don't do anything, and using window.open of course opens the window in a tab.

Upvotes: 0

Views: 645

Answers (1)

sowbug
sowbug

Reputation: 4672

Consider creating a Chrome packaged app, which will allow any number of windows to be opened with a lifetime separate from browser tabs, and then have it talk to your extension with chrome.runtime.sendMessage. Here is a good sample of the concept.

Upvotes: 1

Related Questions