Firefox window.onerror problem - warning "Script error!" only
I am using window.onerror to alert JavaScript errors for debugging.
window.onerror = function(msg, url, line) {
alert(msg + '\nLine: ' + line);
};
On launching the error, it may alert you to the actual error message in IE. But in firefox it just warns "Script error!" But I still see the actual error message in the firefox error console.
I remembered a few months ago when I was working on another project firefox didn't work like that. But I cannot get the code for this project at the moment. So I am wondering what are the possible problems with this?
a source to share
Now I know the answer. After I uploaded the file to the webserver (actually localhost), it visited it via http: //localhost/path/to/the/file.html , the window.onerror event works as expected (as in IE, warning the actual error message instead of "Script error"). But it doesn't work when visiting the file locally via file: /// D: /path/to/the/file.html
Can't figure out why?
a source to share