Search content within the blog

Wednesday, December 17, 2008

Handle javascript error message

onerror = handleErrors

var msg = null

function handleErrors(errorMessage, url, line)
msg += "Error message: " + errorMessage + "\\n";
msg += "URL: " + url + "\\n";
msg += "Line #: " + line;
return true

This would show the error as a message box.

If we want to completely hide the error from the end user and also not show the yellow colour information symbol in the browser, we can remove the line 'alert(msg)'; .

No comments:

Post a Comment