diff --git a/components/Blocks/EmbedBlock.tsx b/components/Blocks/EmbedBlock.tsx index 630853cf..d84e5aca 100644 --- a/components/Blocks/EmbedBlock.tsx +++ b/components/Blocks/EmbedBlock.tsx @@ -153,6 +153,11 @@ export const EmbedBlock = (props: BlockProps & { preview?: boolean }) => { return src.toString(); }, [url, bgPage, primary]); + // check if URL is a YouTube link, so we can set the appropriate referrer policy + // to avoid YT config "Error 153" since they're strict about requiring a valid referer header + let isYouTube = + iframeSrc?.includes("youtube.com") || iframeSrc?.includes("youtu.be"); + if (props.preview) return null; if (!url) { if (!permissions.write) return null; @@ -196,7 +201,9 @@ export const EmbedBlock = (props: BlockProps & { preview?: boolean }) => { src={iframeSrc} allow="fullscreen" loading="lazy" - referrerPolicy="no-referrer" + referrerPolicy={ + isYouTube ? "strict-origin-when-cross-origin" : "no-referrer" + } > @@ -205,8 +212,6 @@ export const EmbedBlock = (props: BlockProps & { preview?: boolean }) => {