简体   繁体   English

JavaScript window.open适用于所有浏览器的大小

[英]JavaScript window.open Correct Size for all browsers

So, basically, I've got a search results screen with an "Open" button for each result. 所以,基本上,我有一个搜索结果屏幕,每个结果都有一个“打开”按钮。 Clicking that button should open a new window with a streamed database BLOB displayed. 单击该按钮应打开一个新窗口,其中显示了流式数据库BLOB。

I have everything working properly except for the correct sizing of the newly opened window. 除了正确调整新打开的窗口大小外,我一切正常。

Here's the code I'm trying to use: 这是我正在尝试使用的代码:

window.open('View.aspx', 'Document', 'width=' + screen.width + ', height=' + screen.availHeight + ');

This seems to work correctly on IE, but it fails on Chrome. 这似乎在IE上正常工作,但在Chrome上失败了。 It seems that Chrome is setting the innerHeight, not the outerHeight, but I can't seem to find a good cross-browser way to make this work. 似乎Chrome正在设置innerHeight,而不是outerHeight,但我似乎无法找到一种良好的跨浏览器方式来实现这项功能。

You can find the window outer size Getting the width/height of the entire browser in IE? 您可以找到窗口外部大小获取IE中整个浏览器的宽度/高度? (there is a solution for other browsers too) and correct size of the window with resizeTo() or resizeBy() . (还有其他浏览器的解决方案)和resizeTo()resizeBy()的窗口大小正确。

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

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