files/en-us/web/api/htmliframeelement/referrerpolicy/index.md
{{APIRef("HTML DOM")}}
The
HTMLIFrameElement.referrerPolicy
property reflects the HTML referrerpolicy attribute of the
{{HTMLElement("iframe")}} element defining which referrer is sent when fetching the
resource.
no-referrer
no-referrer-when-downgrade
origin
https://example.com/page.html will send the referrer
https://example.com/.origin-when-cross-origin
same-origin
strict-origin
strict-origin-when-cross-origin (default)
unsafe-url
: Send a full URL when performing a same-origin or cross-origin request.
[!NOTE] This policy will leak origins and paths from TLS-protected resources to insecure origins. Carefully consider the impact of this setting.
const iframe = document.createElement("iframe");
iframe.src = "/";
iframe.referrerPolicy = "unsafe-url";
const body = document.querySelector("body");
body.appendChild(iframe); // Fetch the image using the complete URL as the referrer
{{Specifications}}
{{Compat}}