Allow attribute will take precedence over 'allowfullscreen'.
I'm getting this warning message because I've added an iframe with both allow="fullscreen" and allowfullscreen
.
allow
doesn't seem to work in IE, Edge, or Firefox, according to .
How can I resolve/silence this warning message in a cross-browser compatible way?
Here's a minimal snippet to reproduce the warning message in Chrome:
const iframe = document.createElement('iframe');
iframe.setAttribute('allowFullScreen', '');
iframe.setAttribute('allow', 'fullscreen');
Allow attribute will take precedence over 'allowfullscreen'.
I'm getting this warning message because I've added an iframe with both allow="fullscreen" and allowfullscreen
.
allow
doesn't seem to work in IE, Edge, or Firefox, according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe.
How can I resolve/silence this warning message in a cross-browser compatible way?
Here's a minimal snippet to reproduce the warning message in Chrome:
const iframe = document.createElement('iframe');
iframe.setAttribute('allowFullScreen', '');
iframe.setAttribute('allow', 'fullscreen');
Share
Improve this question
edited Aug 26, 2019 at 22:33
Andrew Rasmussen
asked Aug 26, 2019 at 22:08
Andrew RasmussenAndrew Rasmussen
15.1k10 gold badges46 silver badges84 bronze badges
2 Answers
Reset to default 9Turns out swapping the order of those setAttribute
lines silences the warning:
const iframe = document.createElement('iframe');
iframe.setAttribute('allow', 'fullscreen'); // must be 1st
iframe.setAttribute('allowFullScreen', '');
On a Vimeo embed iFrame, remove allowFullScreen
altogether.
From
<div class="embed-responsive embed-responsive-16by9"><iframe src="https://player.vimeo.com/video/000000000" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
To
<div class="embed-responsive embed-responsive-16by9"><iframe src="https://player.vimeo.com/video/000000000" allow="autoplay; fullscreen"></iframe></div>