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
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);
Specifications
Specification | Status | Comment |
---|---|---|
XMLHttpRequest | Living Standard | WHATWG living standard |
Browser compatibility
The compatibility table in 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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
responseURL | Chrome Full support 37 | Edge Full support 14 | Firefox Full support 32 | IE No support No | Opera Full support 24 | Safari Full support 8 | WebView Android Full support 37 | Chrome Android Full support 37 | Firefox Android Full support 32 | Opera Android Full support 24 | Safari iOS Full support Yes | Samsung Internet Android Full support 3.0 |
Legend
- Full support
- Full support
- No support
- No support