Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep script running when extension popup is closed

How can I keep the script in the extension running?

I've got a popup.html and my script needs to run on this popup.html. I set the timer, I'm starting it and it starts to count down, once I close the popup, the timer stops. Apparently, the whole popup.html is unloaded once I click away.

like image 278
Ertan Kara Avatar asked Dec 11 '25 14:12

Ertan Kara


1 Answers

Have a look at Web Workers: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

These run in the background indepently from your window context.

Edit: I just checked this again and as @wOxxOm correctly states in his comment you should use Background Pages in chrome extensions. The link provides an example: https://developer.chrome.com/extensions/background_pages

like image 123
digijay Avatar answered Dec 13 '25 03:12

digijay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!