Request: referrerPolicy プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2017年3月.
メモ: この機能はウェブワーカー内で利用可能です。
referrerPolicy は Request インターフェイスの読み取り専用プロパティで、Referer ヘッダーで送信されるどのリファラー情報がリクエストに記載されるべきかを管理する、リファラーポリシーを返します。
値
このリクエストの referrerPolicy を表す文字列です。詳細な情報や使用可能な値については、 HTTP の Referrer-Policy ヘッダーのページを参照してください。
例
次のスニペットでは、 Request.Request() コンストラクターを使って(スクリプトと同じディレクトリーにある画像ファイルのための)新しいリクエストを生成してから、変数にリクエストのリファラーポリシーを保存しています。
js
const myRequest = new Request("flowers.jpg");
const myReferrer = myRequest.referrerPolicy; // returns "" by default
仕様書
| Specification |
|---|
| Fetch> # ref-for-dom-request-referrerpolicy②> |
ブラウザーの互換性
Loading…