HTTP - Referer (Referrer)

About

The referer (or referrer) identifies the URL of the page where a link was clicked (ie where the request originated). It identifies the address of the web page that linked to the resource.

The referer may also be known as the request's initiator.

Its value is given in the referer header field written in a http request (referer is a misspelling of referrer. See HTTP referer note-1)

A referrer source is either:

Syntax

The client, generally a browser would insert the following header in the http request

Referer: https://datacadamia.com/web/http/method

How to get the Referer in Javascript

  • In a iframe
var referrer = parent.document.referrer;
// not in a iframe document.referrer;
  • Print
console.log(referrer);

where:

Policy

The referrer policy modifies the algorithm used to populate the Referer header when fetching subresources, prefetching, or performing navigations.

See HTTP - Referrer-Policy Header


Powered by ComboStrap