getAllResponseHeaders获取网页的http头信息代码

来源:asp之家 时间:2010-03-31 14:31:00 

使用xmlhttp中的getResponseHeader 从响应信息中获取指定的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头信息,example:

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方法完成后才可调用该方法。

标签:getResponseHeader,http头,xmlhttp
0
投稿

猜你喜欢

  • 安装MySQL5.0后出现1607异常的解决办法

    2009-02-26 15:52:00
  • asp如何直接调用Excel数据?

    2010-06-28 18:26:00
  • 教学演示-UBB,剪贴板,textRange及其他

    2008-01-27 13:46:00
  • Javascript——浅析注册事件

    2008-08-19 12:44:00
  • 用户反馈对产品设计的帮助

    2009-02-09 13:15:00
  • CSS样式设计技巧十则

    2008-06-04 12:18:00
  • CSS双线边框研究

    2009-09-03 12:12:00
  • seo网站如何实现301跳转?

    2010-01-15 12:59:00
  • ExtJS 开发总结

    2009-04-28 13:05:00
  • 在SUSE10环境下安装和配置MySQL数据库

    2008-12-17 15:03:00
  • img标签中alt和title属性的正确使用

    2008-01-10 12:59:00
  • XML HttpRequst对象学习

    2007-10-12 19:04:00
  • 大家都对vertical-align的各说各话

    2008-06-19 12:11:00
  • mysql UNIX时间戳与日期的相互转换

    2010-02-10 12:10:00
  • 用XML和XSL来生成动态页面

    2008-09-04 10:35:00
  • MySQL数据库中与 ALTER TABLE 有关的问题

    2009-01-14 11:57:00
  • 怎样设计网站首页?(解答)

    2007-11-04 18:56:00
  • asp如何编写一个加法器?

    2009-11-08 18:58:00
  • 豆瓣可以做而且值得做的几件事情

    2009-04-24 12:07:00
  • asp的分词技术

    2007-08-25 17:50:00
  • asp之家 网络编程 m.aspxhome.com