Referer and Origin headers
Requests tell the destination site which page the visitor came from.
In one line
Can tell which site you came from, usually just the site name, not the page
Requests tell the destination site which page the visitor came from.
The default policy strict-origin-when-cross-origin (Chrome 85, Firefox 87) sends only the origin cross-site. Safari has capped cross-site referrers to the origin since 12.1. Full URLs still go same-site.
What it can and can't do
What the user does: You click a link or load a page that pulls in another site's content
It can
- See the site address you arrived from, such as example.com
- See the full page address when you move around inside the same site
- Count visits by traffic source for analytics
It cannot
- See the full page address of another site you left, in Chrome, Firefox and Safari by default
- See your browsing history beyond the one step before
- Get a referrer if the previous page chose to send none
How it differs between platforms: Safari has limited cross site referrers to the site name for years. Chrome and Firefox did the same by default around 2020 and 2021.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 56 | 2017-01-25 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 50 | 2016-11-15 | None |
| Safari | Supported | 11.1 | 2018-04-12 | None |
| Safari on iPhone | Supported | 12 | 2018-09-17 | None |
| Chrome on Android | Supported | 56 | 2017-02-01 | None |
| Samsung Internet | Supported | 7.2 | 2018-06-20 | None |
How a site asks for it
| API | Referer and Origin request headers; Referrer-Policy; document.referrer |
| Browser compat keys | http.headers.Referrer-Policy |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Navigate or fetch
- Browser applies policy
- Server reads header
Data you get
What comes back: URL or origin
Shape: string
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
Referer | string | None | URL or origin | policy dependent |
Technical limits
- Pages can loosen it with Referrer-Policy: unsafe-url
- Never reveals the referring page across origins by default
The story
What it is
Each request tells the destination which page or site you came from.
For you
You never see it. When you click a link or a page loads an image, the other site learns where you were. Browsers now trim it to just the site name by default, so you share less than before.
For makers
Makers use it to see which sites and ads send visitors, to block other sites from copying their images, and to guard forms from forged requests. The origin header helps stop cross site attacks.
Where you see it
| Type | Example | Apps |
|---|---|---|
| analytics | A shop sees that many visitors arrive from a blog post. The referrer tells it which blog to thank and which affiliate to pay. | Google Analytics |
| ads | An advertiser reads the referrer to check that clicks came from the sites it paid, and to spot fake sites. | None named |
| media | A photo site stops other sites from showing its pictures for free by checking the referrer on image requests. | None named |
| security | A banking site checks the origin header on a transfer form. A request coming from another site is rejected as forged. | None named |
| games | A browser game portal sees which partner site a player came from, so it can credit the partner and show a matching start screen. | Poki, CrazyGames |
| social | A social site shows a link preview but trims the referrer so private page addresses do not leak to the linked site. | None named |
| news | A news site sees visitors from search, social and email, and uses it to pick which subscription offer to show. | None named |
Risks
- Leaks page addresses
- Reveals browsing path
What the platform says
- W3C: Referrer Policy. The standard lets sites choose how much of the previous page address is shared when you click a link.
Good uses and abuse
Legitimate uses
- Analytics and traffic attribution
Known abuse
- Leaks of sensitive URLs, search terms
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 5 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 2 | Rough identifying entropy, when known |
History
- 2020-08, Chrome 85: Default Referrer-Policy strict-origin-when-cross-origin
- 2021-03, Firefox 87: Default Referrer-Policy strict-origin-when-cross-origin
Related capabilities
Related
- Client IP address. Can see the public internet address your connection uses
Sources
How well checked: Based on official documentation.