Skip to content
Advertisement

Progress Bar stopping when tab is not in focus

I’m using the following code for a progress bar:

JavaScript

It works fine (when the page loads, progress bar starts and completes 300frames) but when I switch the tab or minimizes the window it stops and when I reopen the tab, it resumes. I don’t want this top happen. I want the progress bar to continue loading even when not in focus. Is there way to do so ?, cause I saw such progress bars on may other sites.

Advertisement

Answer

Set Interval stops when page is minimize. You can use Date object to check how many time pass since progress bar starts loading.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement