Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate F11 with javascript

How can I simulate F11 (fullscreen not maximaze browser window) as with flash: http://www.broculos.net/files/articles/FullscreenFlash/flashFullscreen.html ?

in flash: fscommand("fullscreen", true )

permadi.com/tutorial/flash9FullScreen/index.html

Thanks

Update

I found this:

var docElm = document.documentElement;

if (docElm.requestFullscreen) {
    docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
    docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
    docElm.webkitRequestFullScreen();
}

/* Exiting the full screen => showing the FULL SCREEN button */
if (docElm.requestFullscreen) {
    document.addEventListener("fullscreenchange", function () {
        if(!document.fullscreen) {
            // Do something
        }
    }, false);
} else  if (docElm.mozRequestFullScreen) {
    document.addEventListener("mozfullscreenchange", function () {
        if(!document.mozFullScreen) {
            // Do something
        }
    }, false);
} else if (docElm.webkitRequestFullScreen) {
    document.addEventListener("webkitfullscreenchange", function () {
        if(!document.webkitIsFullScreen) {
            // Do something
        }
    }, false);
}

this only works (from what've seen) only on a button click. Can't do this on page load

like image 917
Claudiu Avatar asked Jun 22 '10 14:06

Claudiu


1 Answers

This isn't possible with JavaScript. It was proposed for the HTML5 video API but was later scrapped.

like image 140
James Avatar answered Oct 11 '22 14:10

James