Reputation: 109
I made an auto reload script which continuously refreshes a webpage 1 second after the page is completely loaded. It doesn't seem to be too fast, but Chrome will always crash after a while:
"Aw Snap! Something went wrong while displaying this webpage. To continue, reload or go to another page." This is the message I get. It seems the auto-reload script then stops working.
How do I get the script to keep going even after a browser crash?
Thanks
PS: my current script:
if (window.location.toString() === 'http://blabla.com/wut')
{
setTimeout(function (){
window.location.reload(true);
},1000);
}
Upvotes: 0
Views: 1729
Reputation: 2662
You should not reload the page in that way to prevent a browser crash. Instead use something like JQuery to download the dynamic content in a loop from a endpoint that only serves the changed content. It will save allot of data because you can drop allot of headers and unnecessary tags as well as not have to load the CSS and other resources again. Another programmatical answer is to use a browser extension.
After including the JQuery library, you could preform a request like this.
$.get( "a-dynamic-page-source.php", function( data ) {
document.getElementById('dynamic-content').innerHTML = data;
});
Upvotes: 1
Reputation: 1878
You should probably be using ajax instead to do this. Constantly reloading a page is usually not a good idea. In addition, there is no way around the bug.
Upvotes: 0
Reputation: 1078
there's no way, at least not with javascript, and this seems really stupid
browser crash = no more code is executed
Upvotes: 1