Embed a Youtube Channel into HTML with iFrame

2019-05-21 01:45发布

问题:

I'm trying to embed a Youtube channel into a HTML page.

For example I take this channel address: http://www.youtube.com/aaaa

I used this code:

<html>
<head>
</head>
<body>
    <iframe src="http://www.youtube.com/aaaa"></iframe> 
</body>
</html>

The problem is that it doesn't work. I tried with another site, and it works. What can be the problem?

回答1:

The problem seems to be induced by this URL:http://www.youtube.com/aaaa.

I tried some other URLs and it works.

You can try some URLs easily here.


Try this:

  <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube.xml&amp;up_channel=aaaa&amp;synd=open&amp;w=320&amp;h=390&amp;title=&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>


回答2:

Try this:

<div name=iframe style="width:100%; height:635px; border:2px solid grey; overflow:hidden">
  <iframe src="http://yourchannel URL" style=width:100%; height:700px; margin-top: -65px" scrolling=true>
     If you can see this, your browser doesn't support iframes. Click <a href=http://mychannel.url>here to
     see my YouTube channel.</a>
</div>

This should embed complete youtube channel without youtube search bar.



回答3:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/aaaa" frameborder="0">
</iframe>

This was taken from youtube here

it appears IE (and others) can only use [youtube.com /embed/ videoID] (HTML5 Player) - at least the way I am implementing them.



回答4:

To display a gallery of thumbnails of your YouTube Channel's most recent videos, you can use an iframe:

<iframe
    onload="javascript:this.style.height = this.contentWindow.document.body.scrollHeight + 'px';"
    scrolling="no"
    height="600"
    marginheight="0"
    frameborder="0"
    width="480"
    src="http://youtubechannelembed.com/gallery.php?vids=9&user=doitfordummies&row=3&width=150&margin_right=15&desc=100&title=30&views=1&likes=1&dislikes=1&fav=1">
</iframe>