Why iframe tag can't able to show youtube video via link? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why iframe tag can't able to show youtube video via link?

<iframe src="https://youtu.be/0DPLee1TmPo"></iframe> I am sure syntex become correct but it can't work. Full code in my (activity) ' YouTube '. https://code.sololearn.com/W91CYeZ7fZv8/?ref=app

10th Jul 2022, 12:21 PM
Rahul Verma
Rahul Verma - avatar
1 Answer
+ 4
Youtube prevent us to use its video in iframes, thats why you get "same origin" this mean only youtube webpages can access it. You can post it only if you include "embed" in link So replace your src to src="https://youtube.com/embed/0DPLee1TmPo" I replaced youtu.be with youtube.com/embed
10th Jul 2022, 12:31 PM
PanicS
PanicS - avatar