[英]How to open window full screen using javascript
var windowprops = "width=1024,height=768,location=yes,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,top=1,left=1";
var url = "http://silverslady.net/silver/silverbrazil.php?mn=5343";
var myWin = window.open(url, '', windowprops);
myWin.blur();
window.focus();
return true;
That's the code to open window. 这是打开窗口的代码。 What about if I want to open it full screen 如果我想全屏打开怎么办?
<script type="text/javascript">
window.onload = maxWindow;
function maxWindow() {
window.moveTo(0, 0);
if (document.all) {
top.window.resizeTo(screen.availWidth, screen.availHeight);
}
else if (document.layers || document.getElementById) {
if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}
</script>
Something like this in the page to be loaded. 在要加载的页面中有类似的东西。 It's generally considered bad practice to resize browsers without notice really. 在没有通知的情况下调整浏览器大小通常被认为是不好的做法。
You might want to read up on https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Using_full_screen_mode this guide to the fullscreen api. 您可能需要阅读https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Using_full_screen_mode本指南以了解全屏api。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.