show-notice
hide-notice

Thursday, 15 August 2013

Remove related videos from YouTube videos using jQuery


Introduction:

You must have notice that YouTube shows related videos link at the end of playback. This is sometimes quite annoying when you have embedded a video specific to your website and other related videos come up. So in this post, find jQuery code to remove related video shown at the end of playback.

Example:

$(document).ready(function () {
    $('iframe[src*="youtube.com"]').each(function () {
        var sVideoURL = $(this).attr('src');
        if (sVideoURL.indexOf('rel=0') == -1) {
            $(this).attr('src', sVideoURL + '?rel=0');
        }
    });
});



SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com