JavaScript window.open 适用于所有浏览器的正确大小
所以,基本上,我有一个搜索结果屏幕,每个结果都有一个“打开”按钮。单击该按钮应打开一个新窗口,其中显示流式数据库 BLOB。
除了新打开的窗口的尺寸正确之外,我的一切都工作正常。
这是我尝试使用的代码:
window.open('View.aspx', 'Document', 'width=' + screen.width + ', height=' + screen.availHeight + ');
这似乎在 IE 上工作正常,但在 Chrome 上失败。 Chrome似乎正在设置innerHeight,而不是outerHeight,但我似乎找不到一个好的跨浏览器方法来完成这项工作。
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.
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. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以找到窗口外部尺寸获取IE中整个浏览器的宽度/高度?(其他有解决方案浏览器)并使用 resizeTo() 或 resizeBy()。
You can find the window outer size Getting the width/height of the entire browser in IE? (there is a solution for other browsers too) and correct size of the window with resizeTo() or resizeBy().