Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
How does Chrome (and other browsers) handle a “setTimeout” set to higher than 1000 milliseconds when a browser tab is hidden and inactive?

I’m debugging some login/logout issues on a site maintained by an outside vendor for a client and hopefully the title explains things, but more details are below.

As I understand it, any JavaScript running in a hidden tab in Chrome will alter the value of any setTimeout to be 1000 milliseconds to maintain overall system performance and not waste resources. As explained on this site:

“Browsers do exactly this. For inactive tabs, they automatically throttle timers to run every 1 second, regardless of the original delay specified in the code. For example, if the code originally used setInterval() to run some code every 50 ms, once the application is moved to a background tab, the interval automatically becomes 1000 ms (1 second).”

That definitely makes sense in the case of a setTimeout value that is set lower than 1,000 milliseconds like 50 milliseconds and such. But what about values higher than 1,000 milliseconds?

Will Chrome set the setTimeout value to 1,000 milliseconds even though 900,000 milliseconds (aka: 900 seconds, aka: 15 minutes) is clearly higher than that?

Here is a chunk of code from the vendor’s web page I believe is causing issues I am attempting to assist in debugging. It doesn’t do its job when it is in a hidden tab.

function keepSessionAlive() {
    if (externalAdminWindow && externalAdminWindow.closed) {
        externalAdminWindow = null;
    }
    if (externalFGWindow && externalFGWindow.closed) {
        externalFGWindow = null;
    }
    if (externalAdminWindow || externalFGWindow) {
        $find("ctl00_RadAjaxManager1").ajaxRequest("KeepAlive");
        setTimeout(function() {
            keepSessionAlive();
        }, 900000);
    }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Most browsers throttle timeouts in inactive tabs. It means that all setTimeout's will have a minimum of 1000ms timeout. Everything longer than that should work as expected. So, answering your question, 15min timeout should not be affected.

Check out setTimeout's Timeouts in inactive tabs section on MDN: https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#timeouts_in_inactive_tabs

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!