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.

The referrerPolicy property of the HTMLImageElement interface defining which referrer is sent when fetching the resource. It reflects the <img> element's referrerpolicy content attribute.

Value

A string. For the permitted values, 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