firefox window.onerror event problem - alerts "Script error!" only

Posted by powerboy on Stack Overflow See other posts from Stack Overflow or by powerboy
Published on 2010-04-18T19:53:01Z Indexed on 2010/04/18 21:53 UTC
Read the original article Hit count: 341

I use the window.onerror to alert javascript errors for debugging.

window.onerror = function(msg, url, line) {
    alert(msg + '\nLine: ' + line);
};

When an error is fired, it can alert this actual error message in IE. But in firefox, it just alerts "Script error!", but I can still see the actual error message in firefox's error console.

I remembered several months ago when I worked on another project, firefox did not work like this. But I cannot get the code of that project currently. So I wonder what are the possible problems with this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about error-handling