Skip to content

Instantly share code, notes, and snippets.

@karlcow
Created November 7, 2011 18:23
Show Gist options
  • Save karlcow/1345725 to your computer and use it in GitHub Desktop.
Save karlcow/1345725 to your computer and use it in GitHub Desktop.
attempt to log window.onerror on the server with XMLHttpRequest
window.onerror = function(message, url, linenumber) {
if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
var scripturl = "http://127.0.0.1:8069/log";
var log = linenumber + message + url;
xhr.open("POST", scripturl);
xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
xhr.send(log);
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment