← 返回首页
XMLHttpRequest: responseURL プロパティ - Web API | MDN

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

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 になります。

In this article

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

ブラウザーの互換性

Enable JavaScript to view this browser compatibility table.