Update rate for dynamic favicons

I wanted to learn how to dynamically refresh icons using the Google Chrome browser, and I noticed that the browser seems to throttle how often you can update the icon per second, and such things make things messy. Testing page I did for this:

http://staticadmin.com/countdown.html

This is just a scrolling message displaying the countdown results. I added an input field to adjust the number of pixels per second moved with the script, and I looked great max 5 times per second in Google Chrome, and I did not test it in any other browsers.

My question is what is the maximum frequency, are there any ways to change it, and is there any special reason?

NOTE. I also noticed that this value also changes based on the focus of the window. It seems to drop to about 1 update per second when the browser window is not in focus and returns to "max" when you return.

+6
source share
1 answer

True, Chrome (and any reasonable browser) does not expect favicon to ever change. They don’t even show the animation there (only the first frame is frozen and displayed), although this function request is there . The fact that you can change it at all through the DOM is a bit of a hack. That is why the frame rate is unpredictable, it does not even come close to optimization for this.

Chrome (and other browsers) throttle setInterval and friends up to 1 Hz when the tab is blurry, so the animation gets even worse when switching tabs. He does not know that your interval affects the currently visible user interface element.

It is not possible to change this behavior, as well as the maximum frequency, using JavaScript. Unfortunately.

+2
source

Source: https://habr.com/ru/post/973689/


All Articles