瀏覽器故意不上監聽ESC鍵的,跟網頁加載完成之后不能用程序使瀏覽器全屏一樣的道理,避免開發者惡意全屏,不啰嗦,解決辦法如下:
window.onresize = function(){
if(!checkFull()){
//要執行的動作
}
}
function checkFull(){
var isFull = document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
//to fix : false || undefined == undefined
if(isFull === undefined) isFull = false;
return isFull;
}