E
E
Elvis2020-10-25 18:12:16
JavaScript
Elvis, 2020-10-25 18:12:16

Background data transfer and script execution. Is there a way on inactive tabs?

Hey!
Such a situation: if you go to another tab from the site, then after a while chrome stops the execution of scripts and data transfer. For example, on a website, by pressing a button, data is transmitted to the server every second. if you minimize the browser or switch to another tab, after 10-20 seconds the script stops running and the data does not go away.
Is there a way to still execute the script and pass data? I understand that chrome protection is triggered so as not to load the processor and the system as a whole, but maybe there is some kind of flag to disable on a specific site or, in principle, in the entire browser?
If there is such a thing as "visibilitychange" in the Page Visibility API, but as I understand it the other way around, allow the developer to stop scripts as soon as the focus is lost from the tab.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Cheremkhin, 2020-10-25
@Che603000

Use worker
https://developer.mozilla.org/en/docs/DOM/Using_we...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question