Error in "How Do You Embed Videos onto Your Page Using the iframe Element?"

I have issues whenever I change the src attribute value to any link of my choice. Nothing is showing. Why?

The html

<iframe

width=“400”

height=“400”

<!– src=“https://youtu.be/XO7SIvKPr4M?si=xuRfzgqfbaCWhGiR“ –>

title=“Learn JavaScript - Full Course for Beginners (YouTube video)”

allow=“accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share”

referrerpolicy=“strict-origin-when-cross-origin”

allowfullscreen

>

Looks like your src attribute is in between comment tags

I did that because as a new beginner this platform refuse to post my query due to the link so i had no choice than to put it in comment tag

Did you try using the embed link instead?
https://www.youtube.com/embed/XO7SIvKPr4M?si=tMspjzkhYwhP8Fto

Thank you. it worked well when i used embed link. but i kept wondering why i cant use the regular url link found on youtube.

Sounds like a good internet search. :slightly_smiling_face:

“why use youtube embed link in web page rather than regular link” or something like that.

1 Like

that is a design choice from YouTube

1 Like