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?
An inline frame is used to embed another document within the current HTML document. For the fullscreen Iframe, you have to cover the entire viewport.
If you create an iframe, your site becomes vulnerable to cross-site attacks. You may get a submittable malicious web form, phishing your users' personal data. A malicious user can run a plug-in. A malicious user can change the source site URL.
The width and height inside the embed code can be adjusted by changing the numbers between the quotation marks, shown below. The standard size of an iframe for desktop is a width of "560" and height of "315."
Here are some links, which you might find useful. In order "to clarify what should be used once and for all", see the W3.org link.
It sounds like browser manufacturers are adding non-W3C-compliant attributes again into some of their tags. The "allowFullScreen" attribute really belongs in a param tag, but not in the iframe nor video tags themselves.
<object type="application/x-shockwave-flash"> <param name=allowfullscreen value=true> <video>...</video> </object>
You may be out of luck with IE, as it sounds like the browser manufacturers are creating hacks... instead of sticking to the official W3C specs. Any other attributes are optional & can be deprecated at any time.
If you want to show the video, try building it on the page without the iframe tag. Most respectable video serving companies won't be creating browser breaking videos. It's the ads which can cause problems with overlapping content on your page. I assume that's the problem that you're trying to prevent with the iframe tag?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With