window.onerror = function myErrorHandler(errorMsg, url, lineNumber) { if (url == "") { url = "embed in html"; } $.ajax({ url: webSiteRootURL + "objects/ajaxErrorCatcher.php?error=" + encodeURI("JS-Err: " + errorMsg + " @ line " + lineNumber + " in file " + url + " at visit on /channel/5db78e6eb3584"), context: document.body }).done(function () { console.log("A Javascript-error happend. Please tell your admin to clear the folder videos/cache. \r\n If this doesn't help, attach these infos to a github-pull-request: \r\n Msg:" + errorMsg + " \r\n Url: " + url + ", line: " + lineNumber + ", Address: /channel/5db78e6eb3584"); }); return false; } // Just for testing // throw "A Bug"; $(function () { });