该方法设置进入全屏和退出全屏:
HTML代码
<button>全屏</button>
<button>退出全屏</button>
JS代码
var btn = document.querySelector("button");
btn.onclick = function () {
//console.log(document.body.webkitRequestFullScreen);
document.body.webkitRequestFullScreen();
}
document.querySelectorAll("button")[1].onclick = function () {
//此处没有body
document.webkitCancelFullScreen();
}