http-referrer-policy
v1.0.1
Published
HTTP Referrer-Policy
Maintainers
Readme
HTTP Referrer Policy
Installation
npm install --save http-referrer-policyUsage
const referrerPolicy = require( 'http-referrer-policy' )import referrerPolicy from 'http-referrer-policy'API
Constants
- readonly string
referrerPolicy.default- Default policy directive ('strict-origin-when-cross-origin') - readonly array<string>
referrerPolicy.directives- List of supported referrer policy directives
Methods
referrerPolicy.select( directives, fallback )
Select the most restrictive policy from a given Referrer-Policy value,
returning the fallback policy if no value is given or selected.
If no fallback policy is given, referrerPolicy.default is returned.
- string
directives:Referrer-Policyheader field value - string
fallback: Optional. Fallback policy directive.
Returns string
referrerPolicy.url( from, to, directives, fallback )
Constructs the value of a Referer header based on
the policy directive and navigation endpoint URLs.
- string|URL
from: Current (referring) URL. - string|URL
to: URL being navigated to. - string
directives:Referer-Policydirective. - string
fallback: Optional. Fallback policy directive.
Returns string
Resources
- Specification: W3C / webappsec-referrer-policy
- MDN: Headers / Referrer-Policy
