Request: url プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

メモ: この機能はウェブワーカー内で利用可能です。

urlRequest インターフェイスの読み取り専用プロパティで、リクエストの URL を保持します。

リクエストの URL を示す文字列です。

次のスニペットでは、 Request.Request() コンストラクターを使って(スクリプトと同じディレクトリーにある画像ファイルのための)新しいリクエストを生成してから、変数にリクエストの URL を保存しています。

js
const myRequest = new Request("flowers.jpg");
const myURL = myRequest.url; // "https://github.com/mdn/dom-examples/tree/main/fetch/fetch-request/flowers.jpg"

仕様書

Specification
Fetch
# ref-for-dom-request-url③

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
url

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

関連項目