D
D
dollar2018-10-10 10:07:59
JavaScript
dollar, 2018-10-10 10:07:59

How to detect extension popup is closed in Chrome?

window.onclose doesn't help.
When you click on the extension button, a window is created. And then, when it closes, the link to it remains! Function references remain in it and are called without problems from the background page! Events inside popup (including setInterval) remain and fire!
(In FireFox, this is easier - there the popup dies immediately and all links become "dead" and cause an error when used).
How to understand that popup is hidden? The problem is only in Chrome.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2018-10-10
@Taraflex

If you need to store a link to a popup, then the architecture of your extension is sad.
Use chrome.runtime.onMessage / chrome.runtime.sendMessage
or
https://developer.mozilla.org/en-US/docs/Web/API/B...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question