HTMLImageElement: referrerPolicy property - Web APIs | MDN

Value

A string whose value is one of no-referrer, no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, or unsafe-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 by MDN contributors.