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');
Turns 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', '');
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