rel="noopener"
Prevents a new tab from controlling the opener window.
Learn rel, sandbox, integrity, crossorigin, referrerpolicy as part of the HTML attribute system: what they configure, where they belong and which mistakes to avoid.
Security
HTML loads resources, opens links and embeds external content. Security-related attributes help control those boundaries.
They do not replace server security, content security policy or careful dependency choices. They are one layer in a larger defense.
rel, sandbox, integrity, crossorigin, referrerpolicy. Attributes that reduce risk when loading or linking external resources. What belongs here
rel="noopener"Prevents a new tab from controlling the opener window.
sandboxRestricts iframe capabilities.
integrityChecks that a loaded resource matches an expected hash.
crossoriginControls cross-origin resource requests for certain elements.
referrerpolicyLimits what referrer information is sent.
downloadCan change navigation into file download behavior.
Syntax in context
Use them on external links, iframes, scripts, styles and resources loaded from outside your own origin.
<a href="https://example.com" target="_blank" rel="noopener noreferrer"> Open external site </a> <script src="cdn.js" integrity="sha384-..." crossorigin="anonymous"></script>
Good versus weak
<a href="https://example.com" target="_blank" rel="noopener noreferrer"> Open external site </a> <script src="cdn.js" integrity="sha384-..." crossorigin="anonymous"></script>
<a href="https://example.com" target="_blank">External</a> <iframe src="https://unknown.example"></iframe>
Rules that matter
target="_blank" should normally include rel="noopener".
Sandbox iframes unless you know exactly why not.
Integrity helps detect unexpected third-party file changes.
Referrer policy can reduce accidental data leakage.
Production thinking
Attributes are small, but they change how an element works. A good attribute can make a link usable, an image understandable, a form easier to complete or a script safer to load.
Security attributes should not hide the purpose of links or embedded content. Users still need clear labels and context.
Security attributes are small but important hardening details, especially on pages with third-party content.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.