Skip to content

Set IFrame allowfullscreen with javascript

I tried to set allowfullscreen attribute to the iframe, but it doesn’t work:

iframe.allowFullScreen = true

I checked it with chrome -> inspect element, but the iframe has no allowfullscreen attribute, after this code.

Thanks in advance,

Answer

iframe.setAttribute('allowFullScreen', '')