CKTIS / HTML
referrerpolicy — controlling referrer information
The referrerpolicy attribute specifies how much information about the referring page’s address a browser may send in the Referer header during navigation or resource fetching. It applies to a particular element; it is neither a global attribute nor a CORS setting.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
referrerpolicy="no-referrer|no-referrer-when-downgrade|origin|origin-when-cross-origin|same-origin|strict-origin|strict-origin-when-cross-origin|unsafe-url"referrerpolicy is an enumerated attribute on a, area, img, iframe, script, and link. It controls information sent in the HTTP Referer header—the header name intentionally retains its historical spelling. For a and area, it applies to navigation; for img, image fetching; for iframe, frame navigation; and for link, fetching and processing an external resource.
Values: no-referrer omits the header; same-origin sends the address only to the same origin; origin sends only the origin; origin-when-cross-origin sends the address within the same origin and only the origin otherwise. An origin consists of scheme, host, and port; it is not simply the same domain. Here, “address” means the URL with its fragment and login credentials removed, but potentially still including its path and query parameters.
no-referrer-when-downgrade sends the address except when moving from a secure to a less secure context, such as HTTPS → HTTP. strict-origin sends only the origin and omits it on such a downgrade. strict-origin-when-cross-origin sends the address within the same origin, only the origin across origins, and nothing on such a downgrade. unsafe-url sends the address even on a downgrade: it can expose sensitive paths and query parameters.
An omitted attribute, an empty string, and an unrecognized value all mean the empty policy state, not no-referrer; the policy supplied by the document context applies. rel="noreferrer" takes precedence over a hyperlink’s policy. For script, the setting covers the initial fetch and module imports, including import(), but not ordinary fetch() calls in its code. The attribute neither grants CORS permissions nor disables cookies.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Per-link referrer policy</title>
</head>
<body>
<p><a id="private-link" href="#destination" referrerpolicy="no-referrer">Destination with no referrer</a></p>
<p><a id="default-link" href="#destination">Destination without a policy override</a></p>
<p id="destination">Destination</p>
<script>
const privateLink = document.getElementById('private-link');
const defaultLink = document.getElementById('default-link');
for (const link of [privateLink, defaultLink]) {
for (const type of ['click', 'auxclick']) {
link.addEventListener(type, event => event.preventDefault());
}
}
console.log('Explicit link policy: ' + privateLink.referrerPolicy);
console.log('Other link policy override: ' + JSON.stringify(defaultLink.referrerPolicy));
</script>
</body>
</html>Result
Explicit link policy: no-referrer Other link policy override: ""
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.