SetInterval not working fine in Chrome browsers
It's works fine for only 5 min in Chrome then the page doesn't respond; am I missing anything? This is my code. It works fine in Firefox and IE8 browsers:
function do(){
// coding
setTimeout(do,30000);
if(navigator.userAgent.toLower开发者_如何学运维Case().indexOf('chrome') > -1){
setInterval(do,20000);
}
}
do
is a reserved word I believe, in Chrome ( do.. while ):
function do(){}
SyntaxError: Unexpected token do
Try naming it differently?
Wait: Why are you browser sniffing?
Thanks for Your reply . I found that setInterval method will take 100% cpu usage in chrome browser only . see the link below code.google.com/p/chromium/issues/detail?id=25892
精彩评论