开发者

SetInterval not working fine in Chrome browsers

开发者 https://www.devze.com 2023-01-08 03:37 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消