前一段时间HTML5也算是定稿了,CSDN之类的网站也对全屏API进行了部分介绍。但是查了中文资料就没有全屏检测的。下面给出完整的全屏以及检测的方式
function isFullSrc(){ if((window.fullScreen) ||(window.innerWidth == screen.width && window.innerHeight == screen.height)) return true; else return false; } function requestFullScreen() { var de = document.documentElement; if (de.requestFullscreen) { de.requestFullscreen(); } else if (de.mozRequestFullScreen) { de.mozRequestFullScreen(); } else if (de.webkitRequestFullScreen) { de.webkitRequestFullScreen(); } } function exitFullscreen() { var de = document; if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitCancelFullScreen) { de.webkitCancelFullScreen(); } }