Creating the XMLHTTPRequest Object
Many browsers allow the XMLHTTPRequest object to be created directly. One method is to use this snippet. It tries all methods of creating the object until it discovers one that works.
- Created by: Phil Ballard
- Web Site: http://www.crackajax.net/
Microsoft's Internet Explorer uses ActiveX to create the XMLHTTPRequest object, whereas other borwsers — notable the Mozilla/Firefox range — allow the object to be created directly.
There are several ways of tackling this issue, some using browser detection routines (or tools such as BrowserHawk), others taking an approach similar to the following code, which tries all methods of creating the object until it discovers one that works.
Paste this source code into the designated areas.
Paste this code into your script.