简体   繁体   English

具有屏幕尺寸模式的JavaScript的Window.Open()方法仍以最小化模式打开浏览器窗口

[英]JavaScript's Window.Open() method with screen size mode is still opening browser window in minimized mode

Window.Open() method in the following file is still opening the browser window in minimized mode, you still have to click the maximize button on the top right corner of the newly opened window to maximize it. 以下文件中的Window.Open()方法仍以最小化模式打开浏览器窗口,您仍然必须单击新打开的窗口右上角的最大化按钮以使其最大化。 It maximizes the newly opened window to almost full screen but not completely - maybe, 95%. 它将新打开的窗口最大化到几乎全屏,但不完全-可能是95%。 I need to have it open in 100% size (with windows status bar still showing as in the image below). 我需要将其以100%的大小打开(窗口状态栏仍如下图所示)。

You can try by clicking the Try it button after you open the following html file. 打开以下html文件后,可以单击“ Try it按钮进行Try it I've tested on both Chrome and Edge: 我已经在Chrome和Edge上进行了测试:

<html>
<body>

<p>Click the button to open a new browser window.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    window.open('https://www.google.com', 'popup_name','height=' + screen.height + ',width=' + screen.width + ',resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes');
}
</script>

</body>
</html>

Desired size of newly opened window [with occupying the whole screen but desktop's status bar on the bottom is still visible] : 新打开的窗口的期望大小[占据整个屏幕,但底部的桌面状态栏仍然可见]

在此处输入图片说明

You can only provide your preferred window size to the new window. 您只能将首选的窗口大小提供给新窗口。 But, the OS decides what is the maximum/minimum size that the window can have. 但是,操作系统决定窗口可以具有的最大/最小大小。 Maximising the screen might not be possible. 可能无法最大化屏幕。

I believe this related question might help. 我相信这个相关问题可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM