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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *