34

How can I remove the watch later and share buttons from youtube iframe embed player. Using the following embed code for embedding video clips.

<iframe width="854" height="480" src="https://www.youtube.com/embed/cPVgwz5aN1o" frameborder="0" allowfullscreen></iframe>

Using showinfo=0 removes the full Header which also contains the Video Title.

Is it possible to only remove "Watch Later" and "Share" buttons from the header?

Rohit Kumar
  • 829
  • 2
  • 12
  • 21
  • @deendyal-agarwal have answered your question.. U should mark him as right answer. – Kiran Aug 21 '17 at 06:56
  • 1
    @deendyal-agarwal did not answer this question, as his solution which involves adding `showinfo` to the URL of the video removes the title as well as the Watch Later and Share buttons. – James Eberhardt Oct 23 '17 at 16:10

8 Answers8

28

Using YouTube embed's privacy-enhanced mode (youtube-nocookie), it will hide "Watch later" button, but not "Share" button.

<iframe width="854" height="480" src="https://www.youtube-nocookie.com/embed/cPVgwz5aN1o" frameborder="0" allowfullscreen></iframe>
  • static var htmlString: String { return "\(script)" } This is my string and its form as you said but it is not workings – Anita Nagori Feb 26 '20 at 07:14
  • in 2023, this privacy mode is still an optional checkbox when you go to share > embed. however, i am still seeing the share and watch now buttons. – Kermit Feb 19 '23 at 18:10
18

This parameter is deprecated and will be ignored after September 25, 2018.

showinfo=0 it's not support anymore

  • 5
    YouTube embed showinfo has been ignored since September 25, 2018 and there is no suggestion of a workaround or a new parameter that you could send to archive the old results. They have removed it. If you tried to force it out using javascript and css i would almost suggest you are against the TOC which states your not allowed to change that display. People should know you are showing something from YouTube. So you can try Vimeo or self hosted video solution. – Dushan Jun 15 '19 at 16:51
6

As an example, this is what you're trying to do:

document.getElementsByTagName('iframe')[0].contentWindow.getElementsByClassName('ytp-watch-later-button')[0].style.display = 'none';

But, short answer, there is no simple way to do this, because YouTube is on a different domain:

'Not possible from client side . A javascript error will be raised "Error: Permission denied to access property "document"" since the Iframe is not part of your domaine...' https://stackoverflow.com/a/30545122/2488877

Though, you might find an answer suitable to your needs if you're tech-savvy in the answers to the question above.

b00t
  • 409
  • 3
  • 10
5

I don't think it is possible with the iframe method. My reasons for thinking that is:

  • It is not an option listed on their parameters page
  • I found this thread where a member of their team said it was not possible at the time (2012), and they had no plans to add the ability.

You could probably achieve something similar by turning showinfo off, and using the other methods to grab the video title.

Community
  • 1
  • 1
RichardB
  • 2,615
  • 1
  • 11
  • 14
3

Add this line after link

https://www.youtube.com/embed/c5cHjtspa7M?mode=opaque&amp;rel=0&amp;autohide=1&amp;showinfo=0&amp;wmode=transparent

It will disable the share and watch later option

FelixSFD
  • 6,052
  • 10
  • 43
  • 117
  • 1
    and it will also disable the title – ecoe Nov 10 '17 at 02:01
  • 5
    Can you expand on this more? If you are already using an iFrame embed approach.. what does this line even do? Are you trying to point out the parameters? Should this be the SAME YT video ID? (you dont say, you just say use this line?) Not even the same vid url as the OP? How does this obscure line disable share & watch later icons?? – whispers Dec 03 '18 at 18:16
  • 5
    Nope! Doesnt Work! – MMG Aug 01 '19 at 15:20
  • 3
    If you hit this link then you can see it will show the later and watch button – Anita Nagori Feb 26 '20 at 07:12
  • 2
    The `showinfo` attribute was depreciated in Sept 2018. That's why this answer is solution is no longer working. – inspirednz Jan 09 '22 at 23:09
2

showinfo

Note: This parameter is deprecated and will be ignored after September 25, 2018.

Supported values are 0 and 1.

Setting the parameter's value to 0 causes the player to not display information like the video title and uploader before the video starts playing.

If the player is loading a playlist, and you explicitly set the parameter value to 1, then, upon loading, the player will also display thumbnail images for the videos in the playlist.

https://developers.google.com/youtube/player_parameters

1

In the url params put the params : showinfo=0.

Like this : https://www.youtube.com/embed/youidvideo?autoplay=1&rel=0&showinfo=0

It will remove share and watch later button!

0

Use a url query string ?controls=0 to control what is shown:

<iframe 
    src="https://www.youtube-nocookie.com/embed/j8xbAwurfgo?controls=0&rel=0&modestbranding=1&origin=https://key.bio" 
    frameborder="0" 
    allow="encrypted-media;" 
    allowfullscreen>
</iframe>

YouTube Player API Reference for iframe Embeds https://developers.google.com/youtube/iframe_api_reference

Note: this only worked for me on Chrome, not Firefox! Took me a while to figure this out because I use FF for webdev

Kermit
  • 4,922
  • 4
  • 42
  • 74