Open In App

HTTP headers | Referrer-Policy

The Referrer Policy HTTP header sets the parameter for amount of information sent along with Referrer Header while making a request. Referrer policy is used to maintain the security and privacy of source account while fetching resources or performing navigation. This is done by modifying the algorithm used to populate Referrer Header

Referrer Policy can be delivered for a request through various methods. It can be done by simply using the HTTP header or the meta element in HTML which takes referrer keyword as value that in turn allows referrer policy setting through markup or using the referrerpolicy content attribute in HTML. CSS consults the referrer policy of owner document when style attribute is used and policy can be over-written for external stylesheets which have default value of no-referrer-when-downgrade



Syntax : 

Referrer-Policy : no-referrer
Referrer-Policy : no-referrer-when-downgrade
Referrer-Policy : origin
Referrer-Policy : strict-origin
Referrer-Policy : origin-when-cross-origin
Referrer-Policy : strict-origin-when-cross-origin
Referrer-Policy : same-origin
Referrer-Policy : unsafe-url

Directives : This header accepts eight directive as mentioned above and described below:



Examples: This is the standard example given by World Wide Web Consortium. The examples here list the website to which request is sent as the Navigation Website and the referrer information sent along with it. For ease , https://example.com/page.html will be considered origin site for each example. 

Navigation website : https://notexample.com/page.html (or any other website)
Referrer : no referrer sent
Navigation website : https://not.example.com/ 
Referrer : https://example.com/page.html
-------------------------------------------
Navigation Website : http://not.example.com/
Referrer : no referrer sent
Navigation Website : any trustworthy or non-trustworthy URL
Referrer : https://example.com/
Navigation Website : https://not.example.com
Referrer : https://example.com/.
---------------------------------------------
Navigation Website : http://not.example.com
Referrer : no-referrer 
---------------------------------------------
Origin Website : http://example.com/page.html
Navigation Website : any trustworthy or non-trustworthy URL
Referrer : http://example.com/
Navigation Website : https://example.com/not-page.html 
Referrer : https://example.com/page.html
-------------------------------------------------------
Navigation Website : https://not.example.com/ (or a non-trustworthy URL)
Referrer : https://example.com/
Navigation Website : https://example.com/not-page.html
Referrer : https://example.com/page.html.
-------------------------------------------------------
Navigation Website : https://not.example.com/
Referrer : https://example.com/
--------------------------------------------------------
Navigation Website : http://not.example.com/
Referrer : no referrer
Navigation Website : https://example.com/not-page.html 
Referrer : https://example.com/page.html
------------------------------------------------------
Navigation Website : https://not.example.com/
Referrer : no referrer
Navigation Website : Any trustworthy or non-trustworthy URL
Referrer : https://example.com/page.html

Supported Browsers: The browsers supported by HTTP headers Referrer-Policy are listed below

  1. Google Chrome
  2. Safari
  3. Microsoft Edge
  4. Opera
  5. Mozilla Firefox
Article Tags :