Skip to Content
Platform.Ontology

document.referrer

Script-readable copy of the Referer, available the moment a page loads.

Gets silentlyTracking across apps and sitesBefore the visitWeb browsersBefore you visitWhen the page loads

In one line

Can tell which page you came from the moment the page loads

Script-readable copy of the Referer, available the moment a page loads.

Same previous-site data as the header, readable by any script on the page including third-party tags. Tag managers use it to label traffic sources; Safari 26 and Brave can blank it for classified tracker scripts.

What it can and can't do

What the user does: Nothing. It happens when a page loads after you clicked a link

It can

  • Tell which site or page sent you
  • Use that to credit a campaign, ad or search
  • Share the origin of the previous page with analytics tools

It cannot

  • See the full address of the previous page for cross site links, by default only the site name
  • See pages you visited earlier than the last one
  • Know the search words from most search engines
  • Know anything if you typed the address or used a bookmark

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported12008-12-11Value depends on Referrer-Policy
EdgeSupported122015-07-29Value depends on Referrer-Policy
FirefoxSupported12004-11-09Value depends on Referrer-Policy
SafariSupported12003-06-23Value depends on Referrer-Policy
Safari on iPhoneSupported12007-06-29Value depends on Referrer-Policy
Chrome on AndroidSupported182012-06-27Value depends on Referrer-Policy
Samsung InternetSupported1.02013-04-27Value depends on Referrer-Policy

How a site asks for it

APIdocument.referrer
Browser compat keysapi.Document.referrer
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsPer document
How to take it backClear site data, browser privacy settings
Inside an iframeNot listed

Data you get

What comes back: URL string or empty string
Shape: string
How often: once at load

FieldTypeUnitRangePrecision
referrerstringURLempty or URLorigin only cross-origin by default

Technical limits

  • Follows the sender's Referrer-Policy
  • Empty on direct visits, bookmarks, typed URLs and rel=noreferrer links
  • Not available to cross-origin frames beyond what their own request carried

The story

What it is

Any script on a page can read which site you came from.

For you

You never see it. When a page loads, scripts on it, including third party ones, can check where you came from. That may be a search engine, a friend's post or an ad.

For makers

Tag managers use it to label traffic as search, social or ads. Analytics and ad scripts use it for attribution. Because any script can read it, it is also a leak path for details of the page you were on before.

Where you see it

TypeExampleApps
analyticsA blog sees that most readers came from a Reddit post and tags them as social traffic.Google Analytics, Reddit
adsAn ad script checks if you came from a partner site and then shows that partner's offer.None named
shoppingA shop sees you came from a price comparison site and shows a better coupon.Google Shopping, PriceGrabber
securityA login page checks the referrer to spot hits from known phishing sites.None named
gamesA game site checks if you came from a streamer's page and unlocks a bonus for that creator's fans.Twitch, Kongregate
mediaA paywall that checks if you came from a search engine, and lets you read a free article.Wall Street Journal

Risks

  • Leaks where you were before
  • Third party scripts can read it too

What the platform says

Good uses and abuse

Legitimate uses

  • Traffic source attribution
  • Landing page personalisation

Known abuse

  • Cross-site history sniffing by tag vendors

Scores

ScoreValueMeaning
Sensitivity3 of 5How revealing the data is
Utility4 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits1Rough identifying entropy, when known

History

  • 2025-09, Safari 26: Advanced Fingerprinting Protection on by default in regular browsing: classified scripts lose access to document.referrer and URL query parameters (per reporting, verify scope)

Sources

How well checked: Based on official documentation.

On this page