JavaScript:让浏览器全屏显示

  并不是所有人都会按F11让浏览器全屏显示~~~

一、直接上代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>index</title>
</head>
<body>
    <input type="button" value="全屏显示" onclick="fullScreen()">
<script>

    function fullScreen() {
        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");
                wscript.SendKeys("{F11}");
        }
    }    
    
</script>
</body>
</html>

   通过FireFox、360浏览器的极速模式和兼容模式等测试

  

  【参考地址】http://www.jb51.net/article/47038.htm

原文地址:https://www.cnblogs.com/liqingwen/p/4935872.html