function isFullScreen() { return (document.fullScreenElement && document.fullScreenElement !== null) || document.mozFullScreen || document.webkitIsFullScreen; } function requestFullScreen(element) { if (element.requestFullscreen) element.requestFullscreen(); else if (element.msRequestFullscreen) element.msRequestFullscreen(); else if (element.mozRequestFullScreen) element.mozRequestFullScreen(); else if (element.webkitRequestFullscreen) element.webkitRequestFullscreen(); } function cancelFullScreen() { if (document.exitFullscreen) document.exitFullscreen(); else if (document.msExitFullscreen) document.msExitFullscreen(); else if (document.mozCancelFullScreen) document.mozCancelFullScreen(); else if (document.webkitExitFullscreen) document.webkitExitFullscreen(); } function toggleFullScreen(element) { requestFullScreen(element || document.documentElement); cancelFullScreen(); } $(document).ready(function () { $("#fullScreen").click(function () { toggleFullScreen(document.body); }); $("#fullScreen").click(); });
或者对桌面快捷方式加上命令 --kiosk (不能按 F11 退出全屏)