Is there an event for when a Chrome Extension popup is closed?

You can try this. Connect to your background page with chrome.runtime.connect (or chrome.extension.connect before Chrome 26) and port.onDisconnect will be fired in your background page when the popup is closed.


Probably a hacky way, but in the popup page you can listen to

  window.onblur = function(){}

and send a message to active tab.


There is currently no way to figure out when the browser action popup was closed as window.unonload is triggered immediately when the popup finished loading, not when it's closed. There is a bug crbug.com/31262 for this.

Three work arounds available are well described here. They include the port.onDisconnect trick and periodically polling chrome.extension.getViews() from either the popup or a background page.