You can add a window.onerror event handler. In this case, all errors that occur inside the window will be redirected to the handler of this event. (I tested this in Firefox and it worked, but I had problems with it in Chrome. My installation of Chrome is rather confusing, so this may be a problem, but there are Chromium errors that relate to this problem: error # 7771 and error # 8939 )
window.onerror = function (msg, url, line) { alert("Error on line " + line + " in " + url + ":\n" + msg); // return true to prevent browser from displaying error return true; }
jhartz
source share