Embed YouTube Video In HTML Without iframe
Last Updated : Jul 1, 2023
IN - HTML | Written & Updated By - Amruta
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>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- 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.
- 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.
- 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.
- 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.
- You can also give them dimensions with the help of height and width attribute. And able to use any one from them.
- These are the easiest ways to embed a you tube video without using iframe. We hope that you understand the codes properly.
- 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.