I am simply trying to have a YouTube video show up on my site, but instead I'm getting a blank shape of the video. Does anyone know why this could be or how to fix it? Thanks. Here is the portion of my code:
<DOCTYPE html>
<html>
<head>
</head>
<body>
<iframe width="420" height="345"
src="http://www.youtube.com/watch?v=nIsCs9_-LP8">
</iframe>
</body>
</html>
The key issue is the Youtube URL
is missing the embed
part. Every Youtube
video has a embedded
option.
You have:
http://www.youtube.com/watch?v=nIsCs9_-LP8
However we need to remove watch?v=
and add embed/
:
http://www.youtube.com/embed/nIsCs9_-LP8
The first link is meant for the Youtube site (not just the video, but the whole site) itself. The second is a version for the video itself which is what you need to embed onto your site.
Try this (straight from the Youtube video's embed option):
<iframe width="420" height="315" src="http://www.youtube.com/embed/nIsCs9_-LP8" frameborder="0" allowfullscreen></iframe>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With