Fix: set referrerpolicy on embed iframe to prevent Error 153 (fix #51)#52
Open
swashbuck wants to merge 1 commit into
Open
Fix: set referrerpolicy on embed iframe to prevent Error 153 (fix #51)#52swashbuck wants to merge 1 commit into
swashbuck wants to merge 1 commit into
Conversation
YouTube's client-identity policy requires the Referer header on embed requests. Host pages that restrict their referrer policy (e.g. same-origin) strip it, and YouTube rejects the embed with Error 153. Setting referrerpolicy="strict-origin-when-cross-origin" on the iframe overrides the document policy for that request only, matching YouTube's own recommendation. Fixes #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #51
Fix
referrerpolicy="strict-origin-when-cross-origin"on the YouTube embed iframe so it still sends aRefererwhen the host page's own referrer policy would otherwise suppress it. Without aReferer, YouTube rejects the embed with Error 153 (per YouTube's client-identity policy, which itself recommends this exact policy value). See Embed fails with Error 153 when the host page suppresses theRefererheader #51 for the full root-cause writeup and evidence.Testing
<meta name="referrer" content="same-origin">to a course'sindex.htmlto simulate a host that restricts its referrer policy.Refererheader, YouTube returns Error 153.Referer(origin only), embed plays normally. Confirmed via DevTools network inspection — the iframe attribute overrides the document-level policy for that request only, so no other requests are affected.Posted via collaboration with Claude Code