admin管理员组

文章数量:1435859

I'm embedding a youtube video in the HTML with the following code

<iframe width="560" height="315" 
src=";modestbranding=0" frameborder="0" 
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I'm trying to hide/disable the context menu inside the video. to avoid copy video link.

I was going through API documentation, still couldn't find result.

How can achieve this?

fiddle link: /

I'm embedding a youtube video in the HTML with the following code

<iframe width="560" height="315" 
src="https://www.youtube./embed/7MqMyoxMaW4?controls=0&modestbranding=0" frameborder="0" 
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I'm trying to hide/disable the context menu inside the video. to avoid copy video link.

I was going through API documentation, still couldn't find result.

How can achieve this?

fiddle link: https://jsfiddle/us9rev0b/

Share Improve this question asked Dec 13, 2019 at 9:54 Pandiyan CoolPandiyan Cool 6,5938 gold badges53 silver badges90 bronze badges 3
  • This is one type of patch but we can hide it by following pure JavaScript For hide watch later and share button respectively watch later document.getElementsByClassName("ytp-watch-later-button ytp-button ytp-show-watch-later-title")[0].style.display = 'none' share button document.getElementsByClassName("ytp-button ytp-share-button ytp-share-button-visible ytp-show-share-title")[0].style.display = 'none' – Hardik Masalawala Commented Dec 13, 2019 at 10:25
  • @HardikMasalawala consider post your ment as an answer. – Mauricio Arias Olave Commented Dec 14, 2019 at 18:29
  • please check my answer and accept it if it is matches your desired requirement – Hardik Masalawala Commented Dec 16, 2019 at 5:42
Add a ment  | 

1 Answer 1

Reset to default 1

This is one type of patch but we can hide it by following pure JavaScript
For hide watch later

document.getElementsByClassName("ytp-watch-later-button ytp-button ytp-show-watch-later-title")[0].style.display = 'none'

and For share button

document.getElementsByClassName("ytp-button ytp-share-button ytp-share-button-visible ytp-show-share-title")[0].style.display = 'none'

本文标签: javascriptHow to hidedisabled option to copy link of youtube videoStack Overflow