XMLHTTP对象参考之getAllResponseHeaders方法

信息分类:XmlHttp对象参考 来源:Internet 作者:转载并修改 返回首页

getAllResponseHeaders
    获取响应的所有http头

语法
    strValue = oXMLHttpRequest.getAllResponseHeaders();

例子
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
    xmlhttp.open("GET", "http://localhost/sample.xml", false);
    xmlhttp.send();
    alert(xmlhttp.getAllResponseHeaders());

输出由web服务器返回的http头信息,例子:
    Server:Microsoft-IIS/5.1
    X-Powered-By:ASP.NET
    Date:Sat, 07 Jun 2003 23:23:06 GMT
    Content-Type:text/xml
    Accept-Ranges:bytes
    Last Modified:Sat, 06 Jun 2003 17:19:04 GMT
    ETag:"a0e2eeba4f2cc31:97f"
    Content-Length:9

备注
    每个http头名称和值用冒号分割,并以\r\n结束。当send方法完成后才可调用该方法。

相关资源