Website Scripts And Cloud Tutorials

How to hide javascript errors from browser

Byadmin

Apr 13, 2014 ,

Last updated on February 14th, 2022 at 01:04 pm

Click to rate this tutorial!
[Total: 2 Average: 2.5]

Suppress javascript errors on webpage

Any error returned by your javascript is suppressed using the function suppressJSError() as shown in the code below.

<script language="JavaScript">
function suppressJSError() {
return true;
}
window.onerror=suppressJSError;
</script>

window.onerror=suppressJSError will catch all the errors.

Add the above javascript to the header of the web page in which you want to hide the error being thrown in the console/browser.

Click to rate this tutorial!
[Total: 2 Average: 2.5]

Leave a Reply

Your email address will not be published.