function Fullscreen() {
    var elem = document.documentElement;
    // 判断浏览器设备类型
    if (elem.webkitRequestFullScreen) {  // 兼容谷歌
        elem.webkitRequestFullScreen();
    } else if (elem.mozRequestFullScreen) {  // 兼容火狐
        elem.mozRequestFullScreen();
    } else if (elem.requestFullscreen) {
        elem.requestFullscreen();
    } else if (element.msRequestFullscreen) {  // 兼容IE
        elem.msRequestFullscreen();
    } else {
        //浏览器不支持全屏API或已被禁用
    }
}

// 退出全屏在谷歌浏览器无效
function ExitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
}


作者:꧁执笔小白꧂