【问题标题】:Embed a Youtube Channel into HTML with iFrame使用 iFrame 将 Youtube 频道嵌入 HTML
【发布时间】:2012-08-15 22:22:11
【问题描述】:

我正在尝试将 Youtube 频道嵌入 HTML 页面。

比如我取这个频道地址:http://www.youtube.com/aaaa

我使用了这个代码:

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

问题是它不起作用。我尝试了另一个站点,它可以工作。可能是什么问题?

【问题讨论】:

标签: html iframe youtube


【解决方案1】:

试试这个:

<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>
  </iframe>
</div>

这应该嵌入一个没有 youtube 搜索栏的完整 youtube 频道。

【讨论】:

  • 对不起,但这对我不起作用。它只出现一个边框和一条线。而已。也许你会找到另一种解决方案。
  • 它不起作用
【解决方案2】:

要显示您的 YouTube 频道最新视频的缩略图库,您可以使用 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>

【讨论】:

  • 您在此处链接的域似乎已被某个诈骗网站接管。
【解决方案3】:
<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/aaaa" frameborder="0">
</iframe>

这是取自 youtube here

似乎 IE(和其他)只能使用 [youtube.com /embed/ videoID](HTML5 播放器)- 至少是我实现它们的方式。

【讨论】:

  • 看来 IE(和其他)只能使用 [youtube.com /embed/ videoID](HTML5 播放器) - 至少是我实现它们的方式。
【解决方案4】:

问题似乎是由这个网址引起的:http://www.youtube.com/aaaa。

我尝试了一些其他的 URL,它可以工作。

您可以轻松尝试一些网址here。


试试这个:

  <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>

【讨论】:

  • 我编辑了我的答案。如果您上传了自己的视频,这将有效。如果要分享播放列表,只需使用 Youtube 提供的嵌入代码即可。
  • 这更好,有效。但我想在不打开新标签的情况下按订阅按钮...
  • 对不起,我不知道该怎么做。也许这个工具可以帮助你。 widgetbox.com/widgets/make?code=youtube
  • 这很好用。但是界面很丑。有没有直接到youtube的方法?这涉及谷歌模块。
猜你喜欢
  • 2018-02-18
  • 1970-01-01
  • 2020-03-01
  • 2020-04-19
  • 2017-05-02
  • 1970-01-01
  • 2021-08-16
  • 2012-11-12
  • 2016-07-25
相关资源
最近更新 更多