Home  >  Article  >  Web Front-end  >  xmlHTTP example_javascript skills

xmlHTTP example_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:25:03845browse

In fact, there is nothing special. I mainly read the Microsoft VBA Object Manual and found that you can directly use adodbStream to convert charSet. The examples I saw before were all done using VBScript, so I wrote a pure Javascript example
Unfortunately, due to security restrictions, this stuff can only be used by people who make HTA...sigh....

Copy code The code is as follows:

function loadURL(strURL,strSend,strMethod,blnNotWait,aryHeads){
if(!strURL){return(false);}
strSend =strSend?strSend:"";
strMethod=strMethod=="POST"?"POST":"GET";
blnNotWait=blnNotWait?true:false;
var xmlHTTP=new ActiveXObject("MSXML2 .XMLHTTP"); try {
                                                                                                                                                  ){
             return(xmlHTTP); 🎜> var adodbStream=new ActiveXObject("ADODB.Stream"); ​​
adodbStream.Type=1;//1=adTypeBinary
adodbStream.Open();
adodbStream.write( xmlHTTP.responseBody);
adodbStream.position=0;
adodbStream.Type=2;
adodbStream.charset="_autodetect_all";
var re=adodbStream.readText();
adodbStream=null;
        return(re);
      }
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn