document.getElementById("fullscreenButton").onclick = function() { var iframe = document.querySelector("iframe"); if (iframe.requestFullscreen) { iframe.requestFullscreen(); } else if (iframe.mozRequestFullScreen) { /* Firefox */ iframe.mozRequestFullScreen(); } else if (iframe.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ iframe.webkitRequestFullscreen(); } else if (iframe.msRequestFullscreen) { /* IE/Edge */ iframe.msRequestFullscreen(); } else { // Fallback: make the entire document go full screen document.documentElement.requestFullscreen(); } };