Suppressing JS Errors

JavaScript FAQ | Error Handling  

Question: Can I suppress JavaScript error messages?

Answer: Yes – although usually it is not a good design decision to do so. (Normally, you are much better off fixing the errors, rather than just suppressing the error messages.)

To suppress all JavaScript error messages on your HTML page, you can put the following script code in the

section of your page:
<SCRIPT language="JavaScript">
function silentErrorHandler() {return true;}

Or you can use a similar code fragment (without the

tags) in an included .js file, if you have one. For a working code example, see this error handling demo!

Copyright © 1996-2018,