Disable related videos on a embedded Youtube player

Youtube recently added a new feature to the video player used to embed Youtube videos on other website.

The new default player, once the video completes playing, will display a list of related videos.

While this feature could be useful for some users it is probably not wanted on Youtube video aggregation websites.

Fortunately it’s possible to disable related videos.
Let’s see how.

The default player

Let’s take a cool video (I’m a windsurfing addicted).

The default embed code Youtube suggest us is

<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/Yc_J_kXaFSw"></param>
<param name="wmode" value="transparent"></param>
<embed src="https://www.youtube.com/v/Yc_J_kXaFSw" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>

As you can see, at the end of the video the player will display something like this:

Disabling related videos

The trick is to attach to the player URL (http://www.youtube.com/v/Yc_J_kXaFSw) the rel=0 parameter.

The player URL will became http://www.youtube.com/v/Yc_J_kXaFSw&rel;=0

Just update the embed code with the new URL:

<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/Yc_J_kXaFSw&rel=0"></param>
<param name="wmode" value="transparent"></param>
<embed src="https://www.youtube.com/v/Yc_J_kXaFSw&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>

Let’s use valid XHTML code

Unfortunately the embed code provided by Youtube isn’t valid XHTML code and does not pass the W3C’s XHTML validation.

This is really bad as creating valid XHTML web pages is valuable and professional. In some countries it is even required by law for public administration websites.

So we can use something like

<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" width="425" height="350"
data="http://www.youtube.com/v/Yc_J_kXaFSw&rel=0">
<!--> <![endif]-->
<!--[if IE]>
<object type="application/x-shockwave-flash" width="425" height="350"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
<![endif]-->
<param name="movie" value="http://www.youtube.com/v/Yc_J_kXaFSw&rel=0" />
<p>Your browser is not able to display this multimedia content.</p>
</object>

The above code, which come from my Drupal video module, is valid XHTML code and works with the most used web browsers.

The above code generate:

Conclusions

You are now able to control the behavior of Youtube player related video and post on your website Youtube videos following XHTML standards.

References

New! Related Videos Appearing on Embeds at Youtube Blog

  • Login to post comments
  • 408314 reads

Posted in: 

Thank you

Submitted by Mahesh (not verified) on Thu, 2014-03-20 12:42.

It worked

DELETE RELATED VIDEOS

Submitted by Anonymous (not verified) on Sat, 2013-09-14 06:17.

the easiest way to delete unrelated videos (posted sept 2013) is
to ‘ADD’ … something to the end of your ‘real video’

I just add about one minute of SOLID BLACK.jpg

the view will get bored after a few seconds and close the video!

Thanks!

Submitted by Caryn (not verified) on Tue, 2013-03-05 18:56.

Thanks for your easy and simple instructions. Got mine fixed in just a few minutes!

It should say ?rel=0 and not

Submitted by Chai (not verified) on Fri, 2013-02-15 19:53.

It should say ?rel=0 and not &rel=0

If it’s embed code, then

Submitted by Anonymous (not verified) on Fri, 2014-09-12 17:31.

If it’s embed code, then ?rel=0 will work fine. But each link of this type can only have one ? (new term), and if you add ?rel=0 to a regular share link, it will have two ? terms and will not work. The &rel=0 is correct for regular share links.

Thank you!

Submitted by Tara (not verified) on Fri, 2012-06-15 01:07.

I had read the &rel=0 on another site but didn’t know where to insert. On the video I was uploading, the script actually looked like:

value=”http://www.youtube.com/v/2qsdPgFJdP0?version=3&feature=player_detailpage”>

and I ended up deleteing “version=3&feature=player_detailpage” and then putting in &rel=0 before it would work. The video seems to run fine.

THANKS MUCH!

Thank you!

Submitted by Lauren Thomas (not verified) on Tue, 2012-01-24 12:32.

I sure do appreciate all you smart people taking the time to set up these types of forums!

If you want to do this

Submitted by Dave (not verified) on Sat, 2011-11-12 00:54.

If you want to do this automatically, you can use the Youtube embed tool here:

http://www.davewooding.com/how-to-customize-and-embed-a-youtube-video/

Thanks.

Dave

Yeah… but not 4 years ago

Submitted by fabio on Sat, 2011-11-12 01:27.

Yeah… but not 4 years ago ๐Ÿ˜‰

great

Submitted by Anonymous (not verified) on Mon, 2011-08-22 18:57.

thanks a lot!!

Works!

Submitted by Sneaky (not verified) on Tue, 2011-07-19 10:57.

Worked like a charm, thanks for the code(s). Now I got to change all my vids.

admin edit: removed spam looking link. Only links to personal/non profit websites are tolerated.

Yes it is also working well

Submitted by Alan Peterson (not verified) on Tue, 2014-09-16 06:41.

Yes it is also working well for me as i have completed many online programs and document with it and configure them well.

Or use Youtube’s own function…

Submitted by Anonymous (not verified) on Fri, 2011-03-04 13:39.

Alternatively you can use Youtube’s options under the embed code and untick the one that says ‘Include related videos’. ๐Ÿ™‚

Not four years ago.

Submitted by fabio on Fri, 2011-03-04 14:17.

Not four years ago.

Thanks for info Is there a

Submitted by Chris (not verified) on Thu, 2011-02-03 02:36.

Thanks for info

Is there a way once I’ve embeded a youtube in my wordpress blog..that when poeple click on the youtube video it keeps people on my blog when watching youtube video rather than taking them to the youtuve site to watch the video when they click the video twice?

Really appreciate your speedy reply on this

Talk soon
Chris ๐Ÿ™‚

According to

Submitted by fabio on Thu, 2011-02-03 09:34.

According to http://www.warriorforum.com/main-internet-marketing-discussion-forum/210… you can use:

Put this:
<param name="allowNetworking" value="internal">
before the <embed> tag

Put this:
allowNetworking="internal"
after size 

Let me know if that worked.

It works!

Submitted by Anonymous (not verified) on Wed, 2011-01-19 09:21.

Yes it WORKS!!! thanks man!

Admin edit:
 sorry, spam link removed. Only link to personal or nonprofit websites are tolerated.

nice tutorial of video posting

Submitted by Yeast Infection Home Remedy (not verified) on Mon, 2010-12-27 17:21.

hi, i also looking for the way to stop related video at the end of my site.
thanks so much for providing this awesome script.
happy coming new year

ADMIN EDIT: Sorry, link removed. Only links to personal or non commercial websites are tolerated.

Thank you very much, I

Submitted by MyForces (not verified) on Sat, 2010-12-18 01:47.

Thank you very much, I stumbled upon this completely by accident – I wasn’t even looking for articles on how to remove related videos from YouTube player – but this is excellent information and i’ll be definitely implementing this on my own websites. Thanks again.

Thanks very much !

Submitted by Esmoke.dk (not verified) on Thu, 2010-12-16 17:25.

Trying to get rid of those darn after videos with no luck, but your embeed code helped right away.

Thanks very much for your help by posting this :o)

Admin edit: Removed link. I’m sorry only links to personal websites are tolerated.

I’ve been wondering for a

Submitted by Julie Bergsetein (not verified) on Sat, 2010-11-27 12:13.

I’ve been wondering for a while how to disable that “feature” – I always thought it was against the Youtube TOS or if not simply impossible to stop the related videos at the end. I’m glad I can stop it for my website as it looks far more professional to just end the video immediately and not pop up with some more videos which may or may not be relevant to the video I want to display on my page.

Best Wishes, Julie Bergestein.

ADMIN EDIT: removed links to business website. Only links to personal websites or to related pages are tolerated.

Thanks!

Submitted by Anonymous (not verified) on Fri, 2010-11-26 20:36.

Thanks! The content on this page was very helpful.

THANK YOU VERY MUCH. I WAS

Submitted by Raj (not verified) on Wed, 2010-11-17 23:20.

THANK YOU VERY MUCH. I WAS SEARCHING FOR THIS SINCE LONG BACK. It helps me a lot

Thanks very much.

Submitted by Anonymous (not verified) on Wed, 2010-11-17 05:08.

Thanks very much.

thanks so much

Submitted by andrew (not verified) on Wed, 2010-11-10 02:51.

thanks thanks thanks…. this site is very helpful…. keep it up gurus!

Show video without paying $70, nice!

Submitted by Barry L Salter (not verified) on Fri, 2010-11-05 07:11.

Last web site I set up video on we purchased a codac for $70 and it was complicated to set up… This took 5 minutes (faster if it had been a site I was working on) and worked… can’t say thank you enough!

Thank You

Submitted by Jason Wynne (not verified) on Fri, 2010-10-29 15:27.

Just wanted to add thx for this – it is people like you that share information and make developers lives much easier. on a related note, all joomla users note that this works in joomla also.

“I am what I am because of

Submitted by fabio on Fri, 2010-10-29 18:19.

“I am what I am because of who we all are.”

And I would add: If I improve and then share, we all improve.

thanks so much for this also

Submitted by raheel (not verified) on Thu, 2010-09-30 00:04.

thanks so much for this also i wanted to know about how i disable clicking on youtube, dailymotion and other service plyaer

Admin edit: removed spam looking link.

thnks….

Submitted by Manisha Sherla (not verified) on Fri, 2010-07-30 10:31.

thanku for this article….

Thank you very much for your

Submitted by Malid (not verified) on Thu, 2010-07-01 01:36.

Thank you very much for your post.

great

Submitted by Soko Banja Apartmani (not verified) on Wed, 2010-06-30 00:36.

this is great, thanks

disabling related videos

Submitted by Tom (not verified) on Sun, 2010-06-06 01:41.

Excellent. Many thanks for that, extremely irritating YouTube feature disabled on my blog.

Banja Vrujci Video

Submitted by Banja Vrujci (not verified) on Sun, 2010-05-23 18:44.

Thank you for this very useful tip, i dont like these “related videos” at all. Also i have some clips from youtube on my site http://www.banjavrujci.info/smestaj/video and i am going to put your code to disable related videos. Thank you once again

Great blog – Awesome!

Submitted by Brent Lane (not verified) on Thu, 2010-04-29 00:09.

Hey thanks for making that quick and easy tutorial blog. I really rely on things like this for my learning curve. I did just made the changes to my video at http://www.brentlane.com it’s right no the front page. We used green screen actually ($.50 poster board scotch taped together) and then did some pretty neat stuff in the video. Check it out if your interested.

https://youtube.com/watch?v=PslWxTk4IlI%3Frel%3D0%26autoplay%3D0%26wmode%3Dopaque

Once Again thanks for the blog post. It was clean, concise, and most importantly was the first one I found. I am going to link to this blog post from mine on the site. Cheers.

Tool that does this for you

Submitted by Anonymous (not verified) on Fri, 2010-10-22 02:25.

Here is a tool that does this for you:
http://norelatedvideos.weebly.com/

apartmani

Submitted by Soko Banja (not verified) on Wed, 2010-04-21 09:40.

Great tips. Thanx. Very useful

Thank you for the tips!

Submitted by Eaindra (not verified) on Wed, 2010-03-31 10:48.

Thank you for the tips!

Remove embedded youtube video

Submitted by Anonymous (not verified) on Mon, 2010-03-08 04:54.

Can someone tell me how to remove my embedded youtube video from my wordpress front page.

Thanks for the tip

Submitted by Nitin (not verified) on Sat, 2010-02-20 11:12.

Thank you for the excellent tip.

Disable Youtube click through

Submitted by Anonymous (not verified) on Mon, 2010-02-08 16:16.

is it possible to disable a CLICK through to the YOUTUBE site when an embedded video is playing.

i.e. prevent a user such as a child going direct to Youtube?

I’m looking for the

Submitted by Anonymous (not verified) on Wed, 2010-03-31 21:22.

I’m looking for the same!
Anybidy knows how t do this?

I just want to say….

Submitted by Chris Michael (not verified) on Sun, 2010-01-10 03:19.

THANK YOU MAN!

Cheers ๐Ÿ™‚

Graviranje i secenje

Submitted by Graviranje (not verified) on Tue, 2010-01-05 07:31.

Excellent, but anyway I wanted to find somewhere a way to not appear different clips.

&rel=0

Submitted by From brazil (not verified) on Mon, 2010-01-04 20:56.

Sweet tip!!!

tks

Thanks for help – great advice!

Submitted by visitorWeb (not verified) on Wed, 2009-12-16 20:03.

You saved me a lot of time. I started to thing about posting video on some other site instead Youtube – but thanks to you – it is all fixed now.
Works great!

You tube and W3C validation

Submitted by Greeny (not verified) on Fri, 2009-12-11 17:24.

I think you joke.. tell me where why your code is not validating:


Please try this link to see tell me where I wrong:
http://www.validome.org/xml/validate/
Anyone has the Answer but which is that??
Thank you

clever trick

Submitted by Bob Xin (not verified) on Fri, 2009-12-11 15:58.

Actually, I am doing some gray hat technique for youtube videos. I know they can be banned any time. But a lots of thanks to you coz now I am sure that I won’t get banned to disable those videos.

Till now I was using youtube videos in my own player.

grad

Submitted by Loznica (not verified) on Thu, 2009-12-10 12:27.

Thank you very much, this is really to use due to competition….

I’m still having problems

Submitted by Help (not verified) on Wed, 2009-11-25 21:18.

Here is my embedded info where do I place the rel=0?

Thank you so much for your help

Stickers

FSF Associate Member
View Fabio Varesano's profile on LinkedIn
View Fabio Varesano's profile on LinkedIn
My Amazon.com Wish List
Hosted By Site5.com

Popular content

All time:

Recent comments

Advertising

Copyright ยฉ 2007-2013 Fabio Varesano – Some rights reserved.
Privacy Policy

Scroll to Top
Scroll to Top