What is the minimum refresh time for a js refresh? What potential problems do I face with super small refreshes like every 40 millisecons... I have a good reason to do so its not madness.
function refresh(){
var refreshTime = 40;
setTimeout("location.reload(true);",refreshTime);
}
For a single timeout, it doesn't matter.
Instead of passing a string as a first argument, I recommend to pass a function, which allows more flexibility:
setTimeout(function(){
//Do anything you want
}, refreshTime);
For intervals (window.setInterval()
), I usually take 50 as a minimum, because most tasks do not have to be executed over 20 times a second. Heavy functions in an INTERVAL can cause the browser to freeze (eg: multiple CSS updates -> re-rendering the page).