Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to add this video to my website using iframe :

HTML
<iframe width="200" height="200" frameborder="0" allowfullscreen src="http://www.youtube.com/watch?v=S4AQ1nBDBE4"></iframe>


but it did not showing the video and give me an empty page why ?
and how can i fix it.

note : i try this code on other videos its works
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-15 19:23pm    
No, you are not even trying it. This is not how youtube works.
—SA

1 solution

Please see my comment to the question.

Could you pay just a bit more attention to what Youtube itself tells you? Load the video on Youtube site using, for example, the URL you used in your src attribute. (No, this is not what you need to do.) I'm doing it with you. Now, it's loaded. Right-click your mouse on the video screen area. (I don't know your mouse settings, maybe for you this is left button click; in correct terms, use context menu click or keyboard key.) You will see the context menu, use the item "Get embed code".

The code I got is this:
HTML
<iframe width="854" height="510" src="https://www.youtube.com/embed/S4AQ1nBDBE4" frameborder="0" allowfullscreen></iframe>

Can you see the difference? Can you see that the URL is different?

Take care.
—SA
 
Share this answer
 
Comments
ENG.Samy Sammour 27-Feb-15 19:42pm    
aha thanks I got the idea ... i did not know this information.
Sergey Alexandrovich Kryukov 27-Feb-15 19:57pm    
You are welcome. Will you accept the answer formally?
I tested it for you; it really works.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900