All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Embed YouTube Video In HTML Without iframe

Last Updated : Mar 11, 2024

Embed YouTube Video In HTML Without iframe

In this tutorial we will show you the solution of embed YouTube video in HTML without iframe, in our previous session, we saw that how to embed a YouTube video in html. Now, our today’s topic is how to embed you tube video in html without using iframe.

We already say that, there are many ways with the help of which you are able to embed a you tube video.

But the most efficient method is by using iframe. But, don’t worry if you don’t want to use iframe there are also many other ways and we will describe you about them in our session.

Step By Step Guide On Embed Youtube Video In HTML Without iframe :-

Now, there are also many ways without iframe. Such as with the help of embed tag or by using object this. But for this, you must know about how to copy the link from any you tube video, if you know very well.

But if don’t know you must go through our previous article.

Here, below the codes are given in way of examples. So, that you understand how to apply these tags in html codes.

<!DOCTYPE html>
      <html>
        <head>
        <title>
            video
        </title>
    </head>
    <body>
       <object data='https://www.youtube.com/embed/coiagvVFMUw?autoplay=1'
        width='500px' height='300px'>
    </object>
    <br>
    <embed src="https://www.youtube.com/embed/5HXnjZglWjwjij" type="">
    </body>
</html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Here, we create body tag, which is a paired tag. And all the contents that are being to be displayed on browser screen are written here.
  5. Here, is an example of the codes for this article. In the body tag, we show you to embed you tube videos in html without iframe in two ways.
  6. The first one is by using object tag and the other one is by using embed tag. Both are paired tag and have src attribute, in this attribute you have to paste the link of video that is in src attribute of embed tag.
  7. You can also give them dimensions with the help of height and width attribute. And able to use any one from them.
  8. These are the easiest ways to embed a you tube video without using iframe. We hope that you understand the codes properly.
  9. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, hence here we show you how to embed a you tube video without using iframe. We hope that you understand the codes properly.

Here, is assignment for you in which you have to make these videos autoplay. You can catch a hint from our article in which we done this with the help of iframe. I hope this tutorial on embed YouTube video in HTML without iframe helps you.

Author Image About Amruta

Amruta is an Experienced web developer with 4 years for experience she completed her master's with MCA and passionate about programming Languages for creating technical contents like HTML, CSS, JavaScript, Java, Python, PHP, jQuery.

Follow Amruta On Linkedin 🡪