HTML <script> referrerpolicy Attribute
Example
<script src="demo/demo.js" referrerpolicy="no-referrer"></script>
Meaning
The referrerpolicy attribute specifies which referrer to send when fetching the script, or resources fetched by the script.
Note:
- An empty string value "" is both the default value, and a fallback value if referrerpolicy is not supported.
- If referrerpolicy is not explicitly specified on the
<script>element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. - If a higher-level policy is not available, the empty string is treated as being equivalent to strict-origin-when-cross-origin.
Standard Syntax
<script referrerpolicy="value"></script>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| no-referrer | The Referer will not be sent. |
| no-referrer-when-downgrade | The Referer will not be sent to origins without TLS (HTTPS). |
| origin | The sent referrer will be limited to the origin of the referring page ( scheme, host, and port). |
| origin-when-cross-origin | The referrer sent to other origins will be limited to the scheme, the host, and the port. |
| same-origin | A referrer will be sent for same origin, but cross-origin requests will contain no referrer information. |
| strict-origin-when-cross-origin | (default) Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS to HTTPS), and send no to a less secure destination (HTTPS toHTTP). |
| unsafe-url | The referrer will include the origin and the path (but not the fragment, password, or username). |