嵌入Youtube订阅计数器?

时间:2013-06-19 20:23:37

标签: youtube-api youtube-javascript-api

如何在顶部右侧显示此网站(http://atomsforpeace.info/)的订阅计数器按钮?

2 个答案:

答案 0 :(得分:1)

查看他们页面的来源为您提供了他们使用过的代码:

<iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 147px; margin: 0px; left: 0px; visibility: visible; height: 24px;" tabindex="0" vspace="0" width="100%" src="https://www.youtube.com/subscribe_embed?bsv&amp;usegapi=1&amp;channel=[YOUR CHANNEL NAME HERE]&amp;theme=dark&amp;hl=en-US&amp;origin=http%3A%2F%2F[YOUR HOSTNAME HERE]&amp;ic=1&amp;jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.Hm9QrP5wPuw.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTOJmMfO7AjAhJbN5yM-BshnzKg53Q#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Conload&amp;id=I0_1371683853533&amp;parent=http%3A%2F%2F[YOUR HOSTNAME HERE]&amp;rpctoken=33681162" data-gapiattached="true"></iframe>

(请务必替换[此处您的频道名称]和[您的主题名称])

答案 1 :(得分:1)

这不是正确的嵌入代码。它应该是

<div class="g-ytsubscribe" data-channel="CHANNELNAME"></div>
<script src="https://apis.google.com/js/plusone.js"></script>

在此处阅读更多iframe www.youtube.com/subscribe_embed? google plus