Skip to content
Related Articles

Related Articles

Improve Article

HTML <a> referrerpolicy Attribute

  • Last Updated : 17 Jun, 2021

The HTML <a> referrerpolicy attribute is used to specify the reference information that will be sent to the server when the user clicks on a hyperlink. 

Syntax:

<a referrerpolicy="no-referrer|no-referrer-when-downgrade|origin|
         origin-when-cross-origin|same-origin|
         strict-origin-when-cross-origin|unsafe-url"> 

Attribute values:

  • no-referrer: It specifies that no reference information will be sent along with a request.
  • no-referrer-when-downgrade: It has a default value. It specifies that that reference header will not be sent to origins without HTTPS.
  • origin: It specifies to only send the origin of the document as the referrer in all cases.
  • origin-when-cross-origin: It sends the origin, path, and query string when performing a same-origin request, but only sends the origin of the document for other cases.
  • same-origin: It specifies that the referrer will be sent for same-site origins, but cross-origin requests will send no referrer information.
  • strict-origin-when-cross-origin: It sends the origin, path, and query string when performing a same-origin request, only sends the origin when the protocol security level stays the same while performing a cross-origin request (HTTPS/HTTPS), and send no header to any less-secure destinations (HTTPS/HTTP).
  • unsafe-url: It sends an origin, path, and query string as a piece of reference information but does not include password and username.

Example: 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML a referrerpolicy Attribute</title>
</head>
  
<body
   <h2>
    GeeksForGeeks
   </h2>
  <h2>
      HTML Anchor referrerpolicy Attribute
  </h2>
    <p>Welcome to
        <a rel="noopener"
           href="https://ide.geeksforgeeks.org/"
           referrerpolicy="no-referrer">
            GeeksforGeeks
        </a>
     </p>
  
</body>
  
</html>                    

Output:



Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :