两层iframe嵌套导致不能全屏问题

1.两层iframe嵌套,退出全屏要获取父iframe 的document对象

function requestFullScreen(element) {
var requestMethod = element.requestFullScreen
|| element.webkitRequestFullScreen
|| element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) {
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") {
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
//退出全屏
function exitFullScreen() {
var exitMethod = document.exitFullscreen || //W3C
parent.document.mozCancelFullScreen || //Chrome等
parent.document.webkitExitFullscreen || //FireFox
parent.document.webkitExitFullscreen; //IE11
if (exitMethod) {
exitMethod.call(parent.document);
} else if (typeof window.ActiveXObject !== "undefined") {
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{Esc}");
}
}
}



你可能感兴趣的:(两层iframe嵌套导致不能全屏问题)