I'm trying to create an automated program by using javascript console only. I need to use setInterval to make a loop for my program. The relevant part of the code is just like this:
refreshIntervalId=setInterval(tick,500);
So the "tick" function will be recalled every 500 milliseconds.
But the problem is whenever the browser tab is being inactive i.e I minimize it to do something else, the setInterval stop working. When I open the browser again it suddenly repeated so many times to "compensate" for the time the fucntion had not been executed. It is not what I am expected.
I've heard that web workers can solve the problem. I just need one (or two) single code line to work via web workers but since I'm an amateur to IT, I cannot understand all of them. I can only access the browser via JS console and I don't have the access to both HTML and its scripts.
My main goal is to make it loop and break it (setInterval and clearInterval) normally while the browser can still in the inactive mode.
What should I do now? Thank you for reading and hopefully someone can help me solve it!