2013-02-28 143 views
0
<html> 
<body> 

<script src="something"></script> 

<img src="something"> 


<script> 
window.onload = function() { 

//code logic here 

} 
</script> 
</body> 
</html> 


I want to access the http response headers for all the http requests of this page so that I can determine their status. 

如第一个脚本请求的响应标头及其他随后的其他响应标头。如何访问http响应标头

换句话说,我想指出没有。的响应状态是错误的请求。

+0

你有没有考虑只是使用类似提琴手? – 2013-02-28 12:46:27

回答

0

试试这个:

var req = new XMLHttpRequest(); 
req.open('GET', document.location, false); 
req.send(null); 
var headers = req.getAllResponseHeaders().toLowerCase(); 
alert(headers); 
+0

这只会为我提供文档的响应标题,而不是所有请求的响应标题。 – Neeraj 2013-02-28 12:57:03

+0

所有请求的所有响应标头? – 2013-02-28 12:58:07

+1