我看到许多热门网站使用youtube订阅按钮,如所附图片所示。但我不知道如何使用网站上的订阅按钮请查看图片了解更多详细信息
这是使用相同订阅按钮的故事精选的html文本
<div class="video byline">订阅Storypick
您将不得不使用此代码
<iframe width="560" height="315" src="https://www.youtube.com/embed/QFu_Kmn3qOk" frameborder="0" allowfullscreen></iframe>
<script src="https://apis.google.com/js/platform.js"></script>
<script>
function onYtEvent(payload) {
if (payload.eventType == 'subscribe') {
// Add code to handle subscribe event.
} else if (payload.eventType == 'unsubscribe') {
// Add code to handle unsubscribe event.
}
if (window.console) { // for debugging only
window.console.log('YT event: ', payload);
}
}
</script>
检查此链接https://developers.google.com/youtube/youtube_subscribe_button
你可以用按钮选择很多配置
希望这能帮助
小心并愉快地编码
这是@Pedro Lobito
<span style="vertical-align:top"> Subscribe to Storypick </span>
<div id="___ytsubscribe_0" style="text-indent: 0px; margin: 0px; padding: 0px; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 123px; height: 24px; background: transparent;"><iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 123px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 69.1875px;" tabindex="0" vspace="0" width="100%" id="I0_1461955290924" name="I0_1461955290924" src="https://www.youtube.com/subscribe_embed?usegapi=1&channel=Storypick&layout=default&count=default&origin=http%3A%2F%2Fwww.storypick.com&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.HQVJrXyUzfY.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCPsfVIW1uZpDHhPYnkBRXvQcHltAQ#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&id=I0_1461955290924&parent=http%3A%2F%2Fwww.storypick.com&pfname=&rpctoken=32575577" data-gapiattached="true"></iframe></div>
</div>
这是@Pedro Lobito
您可以在此处创建"订阅"按钮。
您也可以制作自己的按钮,然后将其链接到订阅确认页面,您可以通过将?sub_confirmation=1
附加到频道URL来获得该页面。:https://www.youtube.com/channel/your_channel_id?sub_confirmation=1
(示例)