Javascript Fullscreen

How to toggle fullscreen?

function toggleFullScreen() {
    if (document.documentElement) {
        var el = document.documentElement;
        var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
        if ((typeof(rfs) !="undefined") && rfs){
            rfs.call(el);
        } else if(typeof(window.ActiveXObject) != "undefined"){
            // for Internet Explorer
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript!=null) {
                wscript.SendKeys("{F11}");
            }
        }
    }
}

How to detect full screen mode?

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License