Pergunta

I made an auto reload script in Chrome and it goes like this:

if (window.location.toString() === 'http://blabla.com/yup')
{
    setTimeout(function (){
                           window.location.reload(true);
                          },2000);
}

This script runs after the page is fully loaded and I don't think it goes too fast. It does what it should do, but why will this end up making the browser crash after a while? What makes a browser crash happen in this situation?

Probably my main question: how do I make an auto-refresh that doesn't make the browser crash?

-

Thanks for helping me out!

Nenhuma solução correta

Outras dicas

Also more advanced but fully working without crashing your browser.

Use this with target _self or what ever you want:

<script type="text/javascript">
function load()
{
setTimeout("window.open('http://blabla.com/yup', '_self');", 2000);
}
</script>
<body onload="load()"> 

Or this with automatic self and no target code:

<script type="text/javascript">
function load()
{
setTimeout("location.href = 'http://blabla.com/yup';", 2000);
}
</script>
<body onload="load()"> 

Both do the same thing, but in the 1 code you can target it, wile in the second code it will always replace the existing page.

For every 2 sec. re-loading, this simple old code should do the trick.

This is old but works on auto self:

<meta HTTP-EQUIV="Refresh" content="2;URL=http://blabla.com/yup">

It is an old code, but it usually works as it should.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top