Reputation: 152
I see a set of browser error messages on first time loading of a screen. On reloading the page the messages disappear. Is there a way to reload a page when we see JS errors on the console.
Upvotes: 0
Views: 1645
Reputation: 4092
You should stop, and think of what you're doing. It's a bad idea. you should be asking how to fix the errors, and not how to silence them.
Also, constantly refreshing the client because of errors is bad UX.
But, hypothetically speaking, this can be done by overriding the console.error method and invoking a browser refresh instead.
like so:
console.error = function(){
window.location.reload()
}
Upvotes: 2