Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法通过在母版页中编写一些代码来在整个 Web 应用程序中全局捕获 Javascript 错误?
您可以使用该onerror事件:
onerror
var oldOnError = window.onerror; window.onerror = function() { alert('Something bad happened'); //Optionally... oldOnError(); }
请参阅JavaScript 异常处理技术