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.

例如第一个脚本请求的响应头和随后的其他请求。

换句话说,我想数数。响应状态为错误的请求数。

4

1 回答 1

0

尝试这个:

var req = new XMLHttpRequest();
req.open('GET', document.location, false);
req.send(null);
var headers = req.getAllResponseHeaders().toLowerCase();
alert(headers);
于 2013-02-28T12:47:34.753 回答