Handling Script errors in Internet Explorer(IE)

Recently i came across a rather annoying bug in IE. There were numerous script error windows popping up in IE versions. This was in IE10 even. While the code worked well for all other browsers including Mozilla, Chrome, Safari it sucked big time in IE.

To add to my woes, the error was inside framework js script(i was using Yii framework). So after research and working around i came up with the following :

window.onerror = catchMe;
function catchMe(e) {
    //do nothing
    return true;
    //basically telling IE that we have handled the error

And it worked like gem!!

Leave a Reply

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