You designed a cool Ajax application and made sure the engine behind Ajax's server handshake is set up well. What next? Browser compatibility is a very important consideration in Ajax-based web development. This is because Ajax applications are tough on most non-compatible browsers, and your visitors from the old world will not be pleased with the way your screen renders when using Ajax.
The way out is to use JavaScript to weed out the unsupported browsers.
It is time to call up the versatile programming object XMLHttpRequest that allows Ajax applications to make HTTP requests to a server. It is this same object that we will use within this JavaScript code.
XMLHttpRequest is good only for the progressive browsers such as Firefox, and Safari. If you are programming for IE, you have to call up a different object such as Microsoft.XMLHTTP or Msxml2.XMLHTTP. IE 7 users don't need to despair, though. The request XMLHttpRequest is supported by this advanced browser.
The steps involved are simple: include the compatibility check inside a JavaScript function, then call this function before you make any HTTP requests using the object. Let us look at an example for Mozilla-based browsers:
if(window.XMLHttpRequest){
request = new XMLHttpRequest( );
request.onreadystatechange=handleResponse;
request.open("GET",theURL,true);
request.send(null);
}