Search code examples
javascriptiframeyoutubeembedfullscreen

How does Youtube iframe go fullscreen?


I'm developing an iframe, but impossible to go fullscreen from inside the iframe. I can go fullscreen with the fullscreen API from inside the iframe when the iframe and the hosting website are on the same domain. I can also trigger fullscreen from outside the iframe.

But I can't trigger fullscreen from inside the iframe when the hosting website is on a different domain, because of cross-domain policy.

However, YouTube can do this. Do you know how they do it ? Impossible to find out their workaround on the web.

Thanks in advance !


Solution

  • I've found a library that does perfectly the job: https://github.com/bdougherty/BigScreen