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

  • 0
    Hello!
    Such a situation: if you go from the site to another tab, 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 executing and the data does not leave.
    Is there a way to run the script and pass the data anyway? 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 it 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, it's the other way around, to enable the developer to stop scripts as soon as focus is lost from the tab.
    JavaScript Emerson Sanford, Sep 3, 2020

  • 1 Answers
  • 0

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!