最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to hidedisabled option to copy link of youtube video? - Stack Overflow

matteradmin8PV0评论

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'
Post a comment

comment list (0)

  1. No comments so far