JS 获取HTTP请求头的信息
代码:
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
示例图:
获取某一属性的值:
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); alert(req.getResponseHeader('date'))
示例图:
The most terrible person in the world is yourself