allowfullscreen

The best HTML attribute in the world!
  1. Welcome
  2. iframe
  3. YouTube
  4. Examples
  5. Warnings
  6. Errors
  7. Anecdotes
  8. Questions (14)

YouTube

The allowfullscreen HTML attribute can be used to embed YouTube videos. The embedded YouTube video will have a fullscreen button. Here is what the code looks like:

<iframe width="780" height="428" src="//www.youtube.com/embed/oR-6N1Dc_zc" frameborder="0" allowfullscreen></iframe>

On a webpage, the above HTML example will look like this:

To disable the fullscreen button for a YouTube video, you can use the following code:

<iframe width="780" height="428" src="//www.youtube.com/embed/oR-6N1Dc_zc" frameborder="0"></iframe>

And this will render like this:

Notice that the allowfullscreen HTML attribute is missing. Also, when you play the video, the fullscreen button is disabled.