Automatic feedback on JavaScript error

前端 未结 6 1042
再見小時候
再見小時候 2020-12-23 22:56

Is there a way to get an automatic feedback if an error (even syntax errors) occurs when running a JavaScript on the client side?

I was thinking of something like th

6条回答
  •  没有蜡笔的小新
    2020-12-23 23:38

    I'm not sure about syntax errors but it is possible to catch js errors using window.onerror event. Searching for "logging errors in javascript" in google gives you a lot of results...

    Logging JavaScript Errors To ASP.NET: http://james.newtonking.com/archive/2006/05/02/Logging-JavaScript-Errors-To-ASP.NET.aspx (Unfortunately the link to download in the post is broken).

    Logging Client Side JavaScript Errors to the Server: http://www.codeproject.com/KB/ajax/logclientsidejserrors2srv.aspx

    JavaScript Error Notifications: http://www.thecodepage.com/post/JavaScript-Error-Notifications.aspx

提交回复
热议问题