window.onerror = function(errorMessage, url, line) { }
I just stumbled upon this blogpost by xing developer Christopher; who summarizes how they do it in xing. Pretty interesting and clever stuff, here is the code:
window.onerror = function(errorMessage, url, line) { var loggerUrl = "https://www.xing.com/js/logger"; var parameters = "?description=" + escape(errorMessage) + "&url=" + escape(url) + "&line=" + escape(line) + "&parent_url=" + escape(document.location.href) + "&user_agent=" + escape(navigator.userAgent); /** Send error to server */ new Image().src = loggerUrl + parameters; };
For details read the original post here.
No comments:
Post a Comment