Result
埋め込みコードにいちいちrel=0パラメーターを加えるのは面倒なので関連動画が自動でOffになるようにする。他のパラメーターも同じ方法で挿入できますね。
jQuery
$('iframe[src*="youtube.com"]').each(function () { var RemoveRelated = $(this).attr('src'); if (jQuery.inArray('rel=0',RemoveRelated) == -1) { $(this).attr('src', RemoveRelated + '?rel=0'); } });
html
<iframe width="560" height="315" src="http://www.youtube.com/embed/g31LLr1_KFk" frameborder="0" allowfullscreen></iframe>
埋め込みコードはそのまま。
via
http://jquerybyexample.blogspot.com/2013/05/jquery-to-remove-related-videos-from-youtube-videos.html