Skip to content Skip to sidebar Skip to footer

Google Chrome Behaves Differently When The Popup Is Being Inspected

In my attempts to learn how to write Google Chrome extensions I decided to write one where upon clicking a button in the popup the extension opens a new window and opens a new tab

Solution 1:

When you open the new window, it gets focus, thereby the popup loses focus. Normally, Chrome closes an extension popup when it loses focus, but keeps it open when you're inspecting it with WebInspector. It seems that with the popup page, your images list variable gets killed.

3 ideas out of many more to fix this:

  • Instead of one URL, give an array of URLs to the windows.create() function. (best solution)
  • Create the window without giving it focus (add "focused ": false to the object given to the create function) and only give it focus when creating the last tab.
  • Open the tabs from the content script or a background page.

Post a Comment for "Google Chrome Behaves Differently When The Popup Is Being Inspected"