I am trying to open a URl in full screen on click of a button, am using the following code.
(我正在尝试通过单击按钮全屏打开URl,正在使用以下代码。)
The window does open full screen but then on the URL reload just goes back to the orignal screen size,(该窗口确实会全屏打开,但是在重新加载网址后,它又回到了原始屏幕尺寸,)
<script type="text/javascript">
function toggleFullScreen()
{
if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen))
{
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
else
{
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
window.location.href = "http://google.com/";
}
</script>
<input type="button" value="click to toggle fullscreen" onclick="toggleFullScreen();">
I have even tried open page from the same domain, even that doesn't seem to work.
(我什至尝试从同一域打开页面,即使这样似乎也不起作用。)
ask by Cool Techie translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…