nam: XHR funktioniert nicht in Opera

Beitrag lesen

Hi Mathias

Tja, auch das hilft nicht (falls ich alles richtig gemacht habe:)

function loadScript(url) {  
	//check if 'url' is available:  
	var xhr = null;  
	function processReqChange() {  
		// only if req shows "loaded"  
		if (xhr.readyState == 4) {  
			// only if "OK"  
			if (xhr.status == 200) {  
				var head = document.getElementsByTagName('head').item(0);  
				var script = document.createElement('script');  
				script.src = url;  
				script.type = 'text/javascript';  
				head.appendChild(script);  
			} else {  
				alert("There was a problem retrieving the XML data:\n" +  
					xhr.statusText);  
			}  
		}  
	}  
	if (typeof XMLHttpRequest != 'undefined') {  
		xhr = new XMLHttpRequest();  
	}  
	if (!xhr) {  
		try {  
			xhr  = new ActiveXObject("Msxml2.XMLHTTP");  
		} catch(e) {  
			xhr  = null;  
		}  
	}  
	if (xhr) {  
		xhr.onreadystatechange = processReqChange;  
		xhr.open('HEAD', url, true);  
		xhr.send(null);  
	}  
}  
loadScript('script1.js');  

Siehe hier : http://mnn.ch/diversa/opera/opera.html