CHOOSE ANY STEP
FREECODECAMP / HTML / STEP 7 OF 8
freeCodeCamp: Build a Video Display Using iframe, Step 7
Set the referrer policy
Written guidance is free. Step videos are a member benefit.
Add the referrer policy attribute as one lowercase word, exactly as shown. Set its value to strict origin when cross origin, with hyphens between the words inside quotation marks. Keep it on the opening iframe tag.
ORIGINAL WALKTHROUGH ·
Watch with Rob.
Watch the explanation, then apply the change and run the official checks on freeCodeCamp.
You are signed in, but video access needs attention. Check your account access. Your saved work is kept.
Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.
Your goals for this step
- Apply the requirements for “Set the referrer policy” while keeping the earlier page structure.
- Explain referrerpolicy and the role it plays in this change.
- Compare the expected preview with your work before running the official checks.
THE TASK
What step 7 asks you to do
- Your
iframeelement should have areferrerpolicyattribute set tostrict-origin-when-cross-origin.
Based on the official freeCodeCamp step 7 instructions (opens in a new tab).
Why this works
Find the opening iframe tag below the heading. A referrer policy controls which referring page address information accompanies a request. It does not change the video’s appearance.
What you should see in the preview
The player should look unchanged in the preview. For a request to the same origin, this policy can send the full referring address. When crossing origins at the same security level, it sends only the origin. From a secure page to an insecure destination, it sends no referring address information. Modern browsers already use this default, so the attribute makes it explicit.
Illustrative browser result. External embeds, navigation and form submission are disabled here. Open freeCodeCamp to test the real behavior. Drag the lower-right corner to make this preview taller.
Terms to know
- referrerpolicy: Referrer policy
- Controls what referring-page information may be sent when the embedded content is requested.
If your check does not pass
- Your
iframeelement should have areferrerpolicyattribute set tostrict-origin-when-cross-origin.
Use the preview to inspect the structure, then run the checks on freeCodeCamp. Watching here does not submit code or mark an official step complete.
Know where to find it
You do not have to memorize every element or CSS property. Keep useful references nearby:
- W3Schools: iframe (opens in a new tab)
Compare the syntax and a focused example.
- MDN: HTML element reference (opens in a new tab)
Look up the definition, syntax and supported behavior.
What you have accomplished
The change for “Set the referrer policy” is ready to try. Return to freeCodeCamp, compare your result with the requirements, and run its checks. Your official progress stays there.
Independent guidance from The Code Zone, not affiliated with or endorsed by freeCodeCamp. Complete official work and certification requirements on freeCodeCamp. Curriculum checked November 15, 2026. Curriculum source (opens in a new tab).