Capture tab closure in Firefox extension

I am writing an extension that needs to call some JS from the current tab / document when the user closes this tab (some saving, etc.). document.onbeforeunload does not do this for me, because it is also called when the page reloads. I am looking for something like tryToClose, but for tabs.

+3
source share
1 answer

You need to listen for the "TabClose" event in the extension, as shown in Notification when adding or removing bookmarks

I can catch an event. Any pointers on how to prevent tabs from closing? I tried event.stopPropagation () in the handler code. This does not stop closing the bookmark!

+4
source

Source: https://habr.com/ru/post/1716182/


All Articles