Embed YouTube Videos

You can add YouTube videos to your web site by using either the iframe or object HTML tags.

Based on the information from http://www.youtube.com/youtubeonyoursite:

  1. Use the youtube site to find the video you want
  2. Click the 'Share' button below the video
  3. Click the 'Embed' button next to the link they show you
  4. Copy the iframe code given and paste it into the html of your web page.

Although YouTube gives you html code using the iframe tag, you can also include your video using the object tag, as seen in the example below.

Example:

A friend's ski video from Japan (or perhaps just use your favourite funny cat video)

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

See live demo of this example or open in a new window. (Note: close window or tab to return to the guide)

Example:

Use the object tag to show the same video

<html>
 <body>
  <object data="http://www.youtube.com/embed/W7qWa52k-nE"
   width="560" height="315"></object>
 </body>
</html>

See live demo of this example or open in a new window. (Note: close window or tab to return to the guide)