1 // create an XMLHttpRequest instance
2 This. _ createrequestentity = function ()
3 {
4 var req;
5 var msxml_progid = ['msxml2. xmlhttp.8.0 ', 'msxml2. xmlhttp.7.0 ', 'msxml2. xmlhttp.6.0 ', 'msxml2. xmlhttp.5.0 ', 'msxml2. xmlhttp.4.0 ', 'msxml2. xmlhttp.3.0 ', 'msxml2. xmlhttp.2.6 ', 'msxml2. XMLHTTP ', 'Microsoft. XMLHTTP '];
6 try
7 {
8 Req = new XMLHttpRequest ();
9}
10 catch (E)
11 {
12 For (VAR I = 0; I <msxml_progid.length; ++ I)
13 {
14 try
15 {
16 Req = new activexobject (msxml_progid [I]);
17 break;
18}
19 catch (e ){}
20}
21}
22 return req;
23}
24
The above is a script for creating XMLHttpRequest. The logic is to create a later version of XMLHTTP for the IE client. However, in actual use, it is found that the pages of some users are displayed, all Chinese characters are garbled. "All encoding-related files are gb2312." For this reason, it has been fruitless for a long time.
Finally, I suddenly remembered that it was normal for these computers to use the brushless newest linkage program developed by another early ASP, So I suddenly thought of the XMLHTTP version problem and changed the above Code: 1 // create an XMLHttpRequest instance
2 This. _ createrequestentity = function ()
3 {
4 var req;
5 var msxml_progid = ['msxml2. xmlhttp', 'Microsoft. xmlhttp'];
6 try
7 {
8 Req = new XMLHttpRequest ();
9}
10 catch (E)
11 {
12 For (VAR I = 0; I <msxml_progid.length; ++ I)
13 {
14 try
15 {
16 Req = new activexobject (msxml_progid [I]);
17 break;
18}
19 catch (e ){}
20}
21}
22 return req;
23}
24
Test results: Everything is OK. All PCs pass the test.
Alas, I don't understand how Microsoft is doing it. I still have a problem in my mind!