Kanbritech Learn logo
HTML HTML Media 45h track

HTML YouTube

Explain why a watch?v= URL should not be used as the iframe embed URL.

Understand the topic

A YouTube embed uses an iframe with an embed URL rather than the ordinary watch-page URL. It loads third-party content and may involve privacy, network, and site-policy considerations. Use a descriptive title, a responsive aspect ratio, and a direct link alternative. Choose a real video that you have permission to use and that has useful captions.

Worked example

<!-- Replace VIDEO_ID with the chosen video identifier. -->
<iframe src="https://www.youtube-nocookie.com/embed/VIDEO_ID" title="Captioned introduction to our workshop" loading="lazy" allow="fullscreen; picture-in-picture" allowfullscreen style="width: 100%; aspect-ratio: 16 / 9; border: 0;"></iframe>

The privacy-enhanced host is used, but it is still third-party content. The placeholder must be replaced before this becomes a playable embed.

Practice

Explain why a watch?v= URL should not be used as the iframe embed URL.

Show a suggested answer
The watch URL is the full viewing page. Embedding uses /embed/ followed by the video identifier, subject to the video owner allowing embeds.

Common mistake

Do not claim an embed is offline content. It depends on the third-party service and the visitor network.

HTML documentation

Try Coding

Result