JavaScript is a great language and a great tool for building sophisticated web-sites. However due to it’s typeless construct it’s sometimes possible to get strange runtime errors. If you are working on a production-level system and don’t want users to see that ugly error message when they come to your site (for whatever use-case scenario) you can add these two lines to your JavaScript code:
function SupressError(sMessage, sURL, sLine){ return true; }
window.onerror = SupressError;
This works by hooking a dummy function to the window.onerror event.