How to disable full screen on youtube Iframe?

23,116

Solution 1

"I used ?controls=0 at the end of my url and it resolved the issue."

Your answer doesn't solve the problem, you can toggle full screen also double clicking the video. I tried allowfullscreen="0", doesn't work as well.

The same is for ?showinfo=0; also doesn't work.

?showinfo=0 works only if you change link:

https://www.youtube.com/embed/Di2KMatiGAM?controls=0&showinfo=0

to:

    https://www.youtube-nocookie.com/embed/Di2KMatiGAM?controls=0&showinfo=0

Solution 2

Use the iframe tag without allowFullscreen to disable the button on the player, for example:

<iframe src="https://www.youtube.com/embed/12345"></iframe>

To allow fullscreen just add allowFullscreen:

<iframe allowfullscreen="0" src="https://www.youtube.com/embed/@(item.VideoUrl)"></iframe>

Solution 3

when you have a video on youtube you can share it. it also displays an option to embed it.

you probably have a <iframe></iframe> in your code

mine looks like this:

<div class="IFR" alt="-">
    <iframe width="560" height="315" src="https://www.youtube.com/embed/AdfFnTt2UT0 rel=0&amp;controls=1&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" donotallowfullscreen>
        <p>
            Your browser does not support Iframes <br>
            I suggest that you use Google Chrome or FireFox
        </p>
    </iframe>
</div>

the thing that matters here is "donotallowfullscreen". if you set this to "allowfullscreen" you will be able to use fullscreen.

TLDR: in the Iframe tag where your YT video is located, add "donotallowfullscreen" at the end. and its fixed

Solution 4

I used ?controls=0 at the end of my url and it resolved the issue.

Share:
23,116
Morteza Sahebkar
Author by

Morteza Sahebkar

Updated on October 08, 2021

Comments

  • Morteza Sahebkar
    Morteza Sahebkar over 2 years

    I have a div container and Iframe inside. I assigned width=200 and height=200. when I click on full screen, the video becomes blurry with very bad quality. So, I wanted to see if it is possible to disable full screen on youtube iframe.

  • ecoe
    ecoe over 6 years
    in addition to preventing full screen on the iframe, you can disable the full screen icon inside the youtube video player. To do so, add the parameter fs=0: https://www.youtube.com/embed/12345?fs=0