Search code examples
htmlweb-worker

Do HTML5 Web Workers finish if the user leaves or closes browser?


If a web worker starts and then the user goes to another page or closes their browser, does the web worker still finish?


Solution

  • The worker will terminate once all owners have been closed. If you have a shared worker it will stay alive until all owners are closed (it could exist in another tab, for example). Closing the browser will kill all workers always.