A small piece of HTML can change what a visitor sees or how the browser understands a page. In this lesson, you will explore referrerpolicy attribute: controlling referrer data using a short example that you can inspect and change.
The Idea in Plain English
Referrer policy controls how much information about the current URL a browser sends in a Referer request header to the destination.
You can test this using a small local HTML file. Change one part at a time and check the result in the browser before adding more code.
A Working Example
Read the sample once before copying it. Notice the element names and attribute values, then compare them with the explanation below.
<a href="https://example.net/guide"
referrerpolicy="no-referrer">
Read the public guide
</a>
What Each Part Does
- The anchor is a link when its href points to a destination.
- referrerpolicy limits referrer information sent with a request.
- href is the URL or fragment destination of a link.
A link or embedded resource still works; the remote site may receive less page-location information.
Keep the example small while learning. Once it behaves as expected, try it inside a larger page and make sure the URLs, files and surrounding HTML are correct.
Try It Yourself
Try this next: open an external link without sending a referrer. Then inspect the page and explain what changed.
Common Beginner Mistakes
- Assuming a referrer policy removes other tracking signals or makes a third-party request anonymous.
- Copying the code without checking whether its linked files or endpoints exist; sample addresses and file paths need real resources.
- Choosing a tag only because its default appearance looks right, without checking whether it describes the content correctly.
Key Takeaways
- Referrer policy controls how much information about the current URL a browser sends in a Referer request header to the destination.
- A link or embedded resource still works; the remote site may receive less page-location information.
- Test the markup in a browser, and check accessibility and real-world behavior where relevant.