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.
source
share