window.onerror = function (e) { alert(e); }; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { var obj = JSON.parse(xhr.responseText); CCPEVE[obj[0]].apply(CCPEVE, obj[1]); // IGB imposes a 1s delay between JS calls setTimeout(function () { xhr.open("GET", "trusted"); xhr.send(); }, 1000); } }; xhr.open("GET", "trusted"); xhr.send();