window.onerror = function(message, source, lineno, colno, error) {
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("POST", "https://troy-grunt.de/api.php", true);
    xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    var params = JSON.stringify({'type':'error_collector','message':message,'source':source,'line':lineno,'col':colno,'err': error});
    xmlhttp.send(params);
};