-
Notifications
You must be signed in to change notification settings - Fork 1
/
xmlRequest.js
48 lines (46 loc) · 1.11 KB
/
xmlRequest.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/** Retrieves the XMLHTTPRequest object.
* The getRequestObject method is taken from xAJAX
* and is covered by the GNU LESSER GENERAL PUBLIC LICENSE
* See http://www.xajaxproject.org
*/
function XmlRequest()
{
this.getRequestObject = function()
{
var req = null;
// IE7 now has a native XMLHttpRequest object, however,
// it does not allow access to local files, which is
// what we want it for, so choose the ActiveXObject in preference
if (!req && typeof ActiveXObject != "undefined")
{
try
{
req=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
req=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2)
{
try {
req=new ActiveXObject("Msxml2.XMLHTTP.4.0");
}
catch (e3)
{
req=null;
}
}
}
}
if (typeof XMLHttpRequest != "undefined")
req = new XMLHttpRequest();
if(!req && window.createRequest)
req = window.createRequest();
if (!req) window.status = "Request Object Instantiation failed.";
return req;
};
}
var xmlRequest = new XmlRequest();