( function(){ // Neues XHR Objekt function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { // XHR für Chrome/Firefox/Opera/Safari. xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { // XDomainRequest für IE. xhr = new XDomainRequest(); xhr.open(method, url); } else { // CORS not supported. xhr = null; } return xhr; } // der eigentliche Request function httpGetAsync(theUrl, callback){ var xhr = createCORSRequest('GET', theUrl); if (!xhr) { console.log('CORS not supported'); return; } // Response handlers. xhr.onload = function() { callback(xhr.responseText); } xhr.onerror = function() { console.log('Error'); }; xhr.send(null); } httpGetAsync('https://www.brn-ag.de/extpub/c/6409d2d1927d3',function(item){ var container = document.getElementById('brn-6409d2d1927d3'); container.innerHTML = item; }) })();