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

发布于 2024-12-28 06:15:37 字数 354 浏览 1 评论 0原文

所以,基本上,我有一个搜索结果屏幕,每个结果都有一个“打开”按钮。单击该按钮应打开一个新窗口,其中显示流式数据库 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

も星光 2025-01-04 06:15:37

您可以找到窗口外部尺寸获取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().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文