js判定浏览器是否全屏

JavaScript09

js判定浏览器是否全屏,第1张

//设置浏览器全屏

function f_SetFullScreen() {

//如果浏览器不是全屏则将其设置为全屏模式

if (!f_IsFullScreen()) {

var wsShell = new ActiveXObject('WScript.Shell')

wsShell.SendKeys('{F11}')

return false

}

}

//判断浏览器是否全屏

function f_IsFullScreen() {

return (document.body.scrollHeight == window.screen.height &&document.body.scrollWidth == window.screen.width)

}

(function(){

var width= document.documentElement.clientWidth || window.innerWidth

if( width==screen.availWidth){

alert("全屏")

}else{

alert("不是全屏")

}

})()

//刷新检测