1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
As you can see this function creates the correct instance of the
XMLHttpRequest object. If the browser is not
Internet Explorer then it just instantiates the
XMLHttpRequest object, otherwise it tries to create the correct
ActiveX object used by IE to represent
XMLHttpRequest. In this case it tries to instatiates the object from the
newer version going down till the oldest one.
Note: Finally, IE7 seems to use the same object used by other browsers, that is
I advise you to use the above code just to be sure that older browser versions get the correct object in any
case–provided that at least one is available!