1

What is the best way to insert videos from youtube using the tag? How Can I achieve it?

3

The simplest way to play videos in HTML, is by using YouTube as a source. First, you should upload the video to YouTube or copy the embed code of an existing video, which will be inserted in a element in your web page. To have the embed link of the YouTube video follow these simple steps: -Open the video on YouTube and click the share button. -Open the Embed code. -Copy the Source link. As you copy the embed link you can insert it into your HTML document as the src of your element. Also define width and height for your video. Now let’s see how it will look like.

1

YouTube gives you the full tag you need to copy.

Go to the video that you want to embed, click Share, click the Embed option, and then copy/paste the iframe code it gives you.

0

Here is YouTube's help document which tells you how to do it: https://support.google.com/youtube/answer/171780?hl=en

Embed a video

  • On a computer, go to the YouTube video you want to embed.
  • Under the video, click SHARE .
  • Click Embed.
  • From the box that appears, copy the HTML code.
  • Paste the code into your blog or website HTML.
0

If you are using latest html5 version then you should use this code. HTML5 can come up with some new tag Video tag are one of them.

<html>
    <body>
       <video width=auto height=auto controls>
         <source src="https://www.youtube.com/embed/W7qWa52k-nE" type="video/mp4">
        </video>
    </body>
</html>

If you want to use iframe tag you should use this code.

<html>
    <body>
       <iframe src="http://www.youtube.com/embed/W7qWa52k-nE" width=auto height=auto> 
       </iframe>
    </body>
</html>
New contributor
HarshShah is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

you can insert video from youtube using the iframe

code

<iframe heigth=200px width=200px src="https://www.youtube.com/watch?v=0z2nE9dMD1s"> </iframe>
New contributor
Ishan Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

You can insert Video in your webpage using iframe.

Follow this step:

  • Use the youtube site to find the video you want

  • Click the'Share'button below the video

  • Click the 'Embed' button next to the link they show you

  • Copy the iframe code given and paste it into the html of your web page.

Write following code in HTML and paste that link between src attribute.

<html>
 <body>
  <iframe src="http://www.youtube.com/embed/W7qWa52k-nE"
   width="560" height="315" frameborder="0" allowfullscreen></iframe>
 </body>
</html>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.