allowfullscreen

an HTML attribute for the iframe tag
  1. Welcome
  2. Examples
    1. CSS
    2. iframe
    3. React
    4. Vimeo
    5. YouTube
  3. Errors
  4. Anecdotes

Links

  1. querySelectorAll()
  2. Examples Network
  3. Questions LLC

iframe

iframe, short for "inline frame", is the most common way that the allowfullscreen attribute is used. Thanks mostly to video sites like YouTube and Vimeo, videos embedded by third-party websites using an iframe can use the allowfullscreen attribute to enable a "fullscreen" button within the iframe.


Loading a YouTube Video via an iframe with the allowfullscreen attribute

Here is sample code for a YouTube video embedded using an iframe along with the allowfullscreen attribute:

<iframe width="560" height="315" src="//www.youtube.com/embed/jofNR_WkoCE" allowfullscreen></iframe>

When displayed in a browser, the iframe contains a fullscreen button:


Loading a Vimeo Video via an iframe with the allowfullscreen attribute

Here is another code example with a video embedded from Vimeo:

<iframe src="//player.vimeo.com/video/38514156" width="560" height="315" frameborder="0" allowfullscreen></iframe>

And, as before, when the iframe is displayed in a web browser, it looks like this: