Native XMLHttpRequest in IE 7

The IE team has made a very wise decision to natively support XMLHttpRequest in IE 7. XMLHTTPRequest is the foundation of any AJAX usage, and I for one applaud the move to make it available without the demand for using ActiveXObject.

Using object detection, one can easily make your code backwards compatible as well:

var oXMLHttp;
if(typeof XMLHttpRequest != "undefined"){
	/* Code for: 
		IE 7
		Firefox, Mozilla etc
	oXMLHttp = new XMLHttpRequest();
else if(typeof window.ActiveXObject != "undefined"){
		Code for:
			IE 5
			IE 6
	oXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.