XMLHttpRequest: responseURL プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016年8月.
XMLHttpRequest.responseURL
プロパティは読み取り専用で、レスポンスのシリアライズされた URL を返します。 URL が null
の場合は、空文字を返します。 URL に存在する URL フラグメントはすべて取り除かれます。 responseURL
の値は、任意のリダイレクト後に得られる最後の URL になります。
例
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);
仕様書
Specification |
---|
XMLHttpRequest> # the-responseurl-attribute> |
ブラウザーの互換性
Loading…