Request: referrer プロパティ
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.
メモ: この機能はウェブワーカー内で利用可能です。
referrer
は Request
インターフェイスの読み取り専用プロパティで、ユーザーエージェントによってリクエストのリファラーが設定されます(client
や no-referrer
、URL、など)。
メモ: referrer
の値が no-referrer
だった場合、空文字が返されます。
値
このリクエストのリファラーを表す文字列です。
例
次のスニペットでは、 Request.Request()
コンストラクターを使って(スクリプトと同じディレクトリーにある画像ファイルのための)新しいリクエストを生成してから、リクエストのリファラーを変数に保存しています。
js
const myRequest = new Request("flowers.jpg");
const myReferrer = myRequest.referrer; // 既定では "about:client" を返す
仕様書
Specification |
---|
Fetch # ref-for-dom-request-referrer① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
referrer |
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.