-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
45 lines (32 loc) · 1.21 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "Request: referrerPolicy property"
short-title: referrerPolicy
slug: Web/API/Request/referrerPolicy
page-type: web-api-instance-property
browser-compat: api.Request.referrerPolicy
---
{{APIRef("Fetch API")}}
The **`referrerPolicy`** read-only property of the
{{domxref("Request")}} interface returns the referrer policy, which governs what
referrer information, sent in the {{HTTPHeader("Referer")}} header, should be included
with the request.
## Value
A string representing the request's `referrerPolicy`. For
more information and possible values, see the {{HTTPHeader("Referrer-Policy")}} HTTP
header page.
## Examples
In the following snippet, we create a new request using the
{{domxref("Request.Request", "Request()")}} constructor (for an image file in the same directory as
the script), then save the request referrer policy in a variable:
```js
const myRequest = new Request("flowers.jpg");
const myReferrer = myRequest.referrerPolicy; // returns "" by default
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [ServiceWorker API](/en-US/docs/Web/API/Service_Worker_API)
- [HTTP access control (CORS)](/en-US/docs/Web/HTTP/CORS)
- [HTTP](/en-US/docs/Web/HTTP)