XMLHttpRequest.responseURL
只读属性XMLHttpRequest.responseURL
返回响应的序列化URL,如果URL为空则返回空字符串。如果URL有锚点,则位于URL # 后面的内容会被删除。如果URL有重定向, responseURL
的值会是经过多次重定向后的最终 URL 。
实例
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://example.com/test', true);
xhr.onload = function () {
console.log(xhr.responseURL); // http://example.com/test
};
xhr.send(null);
规范
Specification | Status | Comment |
---|---|---|
XMLHttpRequest | Living Standard | WHATWG living standard |
浏览器兼容性
BCD tables only load in the browser