Skip to content Skip to sidebar Skip to footer

Does Safari Support Javascript Window.onerror?

I have a function attached to window.onerror window.onerror = function(errorMsg, url, line) { window.alert('asdf'); };'; This works fine in firefo

Solution 1:

Yes, Safari does support window.onerror with the function signature you posted: function(errorMsg, url, line), presumably since about 2011 when webkit added it.

However it does not currently support the new signature which includes the stack trace and column number: function(errorMsg, url, line, column, errorObject). This appears to be in the works, however: https://bugs.webkit.org/show_bug.cgi?id=55092

Firefox and Chrome already support the new syntax:

https://bugzilla.mozilla.org/show_bug.cgi?id=355430

https://code.google.com/p/chromium/issues/detail?id=147127

Solution 2:

All major browsers now support the syntax function(errorMsg, url, line, column, errorObject). For more info see the article: https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror

Post a Comment for "Does Safari Support Javascript Window.onerror?"