K
K
Ksenia2014-03-29 15:55:23
JavaScript
Ksenia, 2014-03-29 15:55:23

How to catch browser close in chrome extension?

Hello gentlemen!
I am writing a chrome extension, this is my first experience.
I have a timer function that runs all the time the browser is open.
Today I discovered one problem: after closing the browser, I soon reopened it, and the timer continued to work.
So, tell me, please, how can I catch the moment the browser closes in my js-file, so that at that moment I can stop executing my function?
Thank you for attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Khirenko, 2014-03-29
@Satanpit

stackoverflow.com/questions/3390470/event-onbrowse...

chrome.windows.onRemoved.addListener(function(windowId){
  alert("!! Exiting the Browser !!");
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question