Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLImageElement
  4. referrerPolicy

HTMLImageElement: referrerPolicy property

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨September 2020⁩.

* Some parts of this feature may have varying levels of support.

ThereferrerPolicy property of theHTMLImageElement interface defining which referrer is sent when fetching the resource. It reflects the<img> element'sreferrerpolicy content attribute.

Value

A string whose value is one ofno-referrer,no-referrer-when-downgrade,origin,origin-when-cross-origin,same-origin,strict-origin,strict-origin-when-cross-origin, orunsafe-url. For their meanings, see the HTML<img> reference.

Examples

js
const img = new Image();img.src = "img/logo.png";img.referrerPolicy = "origin";const div = document.getElementById("divAround");div.appendChild(img); // Fetch the image using the origin as the referrer

Specifications

Specification
HTML
# dom-img-referrerpolicy

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp