Disable related videos on a embedded Youtube player

Last updated on Sun, 2010-06-06 09:59. Originally submitted by fabio on 2007-08-23 12:19.

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="http://www.youtube.com/v/Yc_J_kXaFSw" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>

Which will generate this:

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

Youtube related videosYoutube related videos

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="http://www.youtube.com/v/Yc_J_kXaFSw&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>

The player now looks like:

We don't have more related videos!

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:

Your browser is not able to display this multimedia content.

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

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

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.

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.

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

Hi, Thanks a ton. It really

Submitted by Ram (not verified) on Tue, 2009-11-17 07:15.

Hi,

Thanks a ton. It really helped save lot of time.....

Thankyou worked a treat!

Submitted by Moonbeam (not verified) on Tue, 2009-11-10 14:04.

Thankyou worked a treat!

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a personal or company website insert its address in the form http://www.example.com/ .
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <small> <del> <img> <h2> <h3> <h4> <b> <video> <sub> <sup>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may insert videos with [video:URL]
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options