XMLHttpRequest: responseURL property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers, except for Service Workers.
The read-only XMLHttpRequest.responseURL
property returns the serialized URL of the response or the empty string if the URL is null
. If the URL is returned, any URL fragment present in the URL will be stripped away. The value of responseURL
will be the final URL obtained after any redirects.
Example
js
const xhr = new XMLHttpRequest();
xhr.open("GET", "http://example.com/test", true);
xhr.onload = () => {
console.log(xhr.responseURL); // http://example.com/test
};
xhr.send(null);
Specifications
Specification |
---|
XMLHttpRequest # the-responseurl-attribute |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
responseURL |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.