Allowing an iframe to become full-screen, cross-browser

Viewed 5383

I have some code which I use to display a video within an iframe. 99% of the time if works when the user wants to switch to fullscreen, in whatever browser.

However, we've found a couple of examples in IE where the fullscreen option only expands to fit the size of the iframe.

The iframe tag is rendered as follows:

<iframe id="FrameContent" allowtransparency="true" frameborder="0" title="" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" src="/whatever.aspx" style="width: 1660px; height: 867px; visibility: visible;"></iframe>

All parent/child iframes have the above allowfullscreen attributes.

However, from reading here and elsewhere, it seems the consensus is to use allowfullscreen only, with ="true" specified. Some the above code would be changed to render as follows -

<iframe id="FrameContent" allowtransparency="true" frameborder="0" title="" allowfullscreen src="/whatever.aspx" style="width: 1660px; height: 867px; visibility: visible;"></iframe>

Also, the others (webkitallowfullscreen & mozallowfullscreen) seem to have been deprecated so are no longer needed, is that correct?

I've seen other suggestions, such as using allowfullscreen="allowfullscreen" or allowfullscreen="" (because ="true" doesn't work!)

I've also seen msallowfullscreen and oallowfullscreen mentioned, and we don't currently use those.

Anyone able to clarify what should be used once and for all?

1 Answers
Related