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

前端 未结 4 1812
说谎
说谎 2020-11-29 05:28

I\'ve already tried window.unload, window.beforeunload, etc. I\'m looking for a way to notify my background page once the popup is closed.

4条回答
  •  天命终不由人
    2020-11-29 05:48

    Finally found the solution. Put below code in background.js/eventPage.js:

    chrome.windows.onFocusChanged.addListener(function(window) {
        //handle close event
    });
    

提交回复
热议问题