window.resizeTo 影响后续的 Firefox 窗口

发布于 2024-07-06 05:16:53 字数 213 浏览 4 评论 0 原文

我有一个网络应用程序,它可以调整其窗口大小以完全适合其内容:

window.resizeTo(200,300)

人们确实喜欢让页面以这种方式适合其窗口。 然而,对于 Firefox,用户打开的下一个浏览器窗口的大小相同,小得离谱。

有没有办法告诉 Firefox 调整当前窗口的大小,但不改变其后续窗口应该有多大的概念?

I have a webapp which resizes its window to exactly fit its contents:

window.resizeTo(200,300)

People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is ridiculously small.

Is there a way to tell Firefox to resize the current window, but not change its notion of how large subsequent windows should be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(7

要走就滚别墨迹 2024-07-13 05:16:53

这里有两个不同的问题:

1。 指定窗口尺寸-

使用window.open指定窗口属性不会影响其他窗口的尺寸。
您将从 Firefox 获得有关 resizeTo 函数的预期行为

2. 用户体验-

用户首先看重的是保持对他们的环境和您的产品的控制。 让他们调整浏览器窗口的大小很重要。 浏览器是桌面计算机上的应用程序,大多数窗口操作系统都允许用户对窗口的大小和位置进行总体控制。 控制窗口的大小是进入他们的个人工作区的一个步骤。

我同意@Shog9,您应该重新考虑对 window.resizeTo 的使用。强制窗口到任何特定大小可能不合适,除非在的情况下>弹出窗口。 使用 液体布局可以帮助您实现可接受的任何合理窗口尺寸的设计

Two different questions at work here:

1. Specifying Window Dimensions-

Specifying window attributes using window.open will not affect the dimensions of other windows.
You are getting the expected behavior from Firefox with regards to the resizeTo function.

2. The User Experience-

What users value first and foremost is maintaining control of their environment and your product. It's important to let them resize their browser windows. The browser is an application on their desktop machine, and most windowed operating systems give the user general control over the size and placement of windows. Controlling the size of the window is a step into their personal workspace.

I'm in agreement with @Shog9, that you should reconsider your use of window.resizeTo.. It's probably not appropriate to force the window to any particular size, except perhaps in the case of a popup. Using Liquid layouts may help you achieve an acceptable design for any reasonable window dimension.

°如果伤别离去 2024-07-13 05:16:53

正如已经提到的海报之一一样,唯一的方法是在通过 window.open 打开新弹出窗口时设置宽度和高度 - window.open('http://www.google.com', '测试', 'width=800, height=800');
无论出于政治还是技术原因,Window.resizeTo 从未在 Firefox 中工作过。
显然 Firefox 开发人员设法在 Firefox 3.01 中破坏了 window.open(),请参阅这篇博客文章 -
http://tough-to- find.blogspot.com/2008/07/firefox-301-breaks-windowopen-width.html

The only way to do it as one of the poster already mentioned is to set width and height when you open new popup by window.open - window.open('http://www.google.com', 'Test', 'width=800, height=800');
Window.resizeTo never worked in Firefox for whatever reason, political ot technical.
And apparently Firefox developers managed to broke window.open() in Firefox 3.01, refer to this blog post -
http://tough-to-find.blogspot.com/2008/07/firefox-301-breaks-windowopen-width.html

伪心 2024-07-13 05:16:53

人们确实喜欢让页面以这种方式适合其窗口。

哪些人?! 如果网页对我的浏览器窗口的大小做了任何事情,我会非常恼火。 幸运的是,FF 还允许用户禁用移动或调整现有窗口的大小,这是我多年来一直利用的功能。

您应该能够使用 新窗口>window.open,所以您可以使用它...或者更好的是,只需允许您的文档调整大小/重排以适应用户喜欢的任何窗口大小。

People do like having the page fit its window in this way.

Which people?! I'd be seriously annoyed if a web page did anything to the size of my browser window. Fortunately, FF also allows users to disable moving or resizing existing windows, a feature i've taken advantage of for several years.

You should be able to open a new window at a specific size using window.open, so you could use that... or better yet, just allow your document to resize / reflow to fit into whatever window size the user prefers.

公布 2024-07-13 05:16:53

啊,我有一个天气网站这样做:尝试生成一个弹出窗口(最终成为一个新选项卡)并调整它的大小(从而调整整个 Firefox 浏览器的大小!)。

不用说我讨厌它。

一些弹出窗口被阻止,其他弹出窗口设法显示为弹出窗口,其他弹出窗口则转到新选项卡。 这取决于生成它们的方法以及浏览器/扩展设置。 几乎不可能控制,更不用说跨浏览器了。

现代的方法(对于广告来说仍然很烦人!)是做 div 覆盖,有点不那么侵入性。 当然,它可能无法满足所有需求。

Argh, I have a weather site doing that: trying to spawn a popup (which ends being a new tab) and resizing it (thus resizing the whole Firefox browser!).

No need to say I hate it.

Some popups are blocked, others manage to be displayed as popup, others go to a new tab. It depends on the method used to spawn them and the browser/extensions settings. Nearly impossible to control, even less in a cross-browser way.

The modern way (still very annoying for ads!) is to do div overlays, a bit less intrusive. Of course, it might not suit every need.

痴情 2024-07-13 05:16:53

只是想补充一点,最好的办法是避免使用 window.open 并使用某种 LightWindow 框架 - 更好,在所有浏览器上表现相同,并且不受浏览器选项的影响。
您可以在此处查看示例框架 http://www.stickmanlabs.com/lightwindow/

Just want to add that your best shot is to avoid using window.open and use instead some sort of LightWindow framework - much nicer, behaves the same on all browsers and not affected by browser options.
You can see a sample framework here http://www.stickmanlabs.com/lightwindow/

旧伤慢歌 2024-07-13 05:16:53

强烈同意,几乎在所有情况下,调整视口大小的网站都非常糟糕。

应用程序窗口的大小由用户决定,而不是由网站所有者来决定。

在极少数情况下,可能会有一个很好的论据,或者客户可能只是坚持这样做,因为“他们更了解”,但这总是很糟糕。

对于大多数用户来说,这是一个巨大的烦恼,尤其是当您以 1600 像素宽打开 17 个选项卡时,并且某些打印设计师规定您打开的下一个选项卡应强制所有其他选项卡的宽度为 300 像素。

使用诸如厚/浅/灰/薄盒技术之类的技术对用户更加友好。

我只是找到替代网站,或者运行一个greasemonkey 脚本来避免网站这样做。

只好吐槽一下。 对不起。

Strongly agree that in nearly every case, sites that resize the viewport totally suck.

The size of the app window is for the user to decide, and not for web site owners to screw with.

In very rare cases there may be a good argument for it, or a client might just insist on it cos "they know better", but it always sucks.

It is a huge annoyance for most users, especially when you have 17 tabs open at 1600 px wide, and some print designer decreed that the next tab you open, should force all your other ones to 300 px wide.

It is much more user friendly to use something like thick/light/grey/slim-box techniques.

I just find alternative web sites, or run a greasemonkey script to avoid sites doing that.

Just had to rant about that. Sorry.

带上头具痛哭 2024-07-13 05:16:53

以下是一些可能有助于用户阅读本文的相关信息。

Firefox 迫于压力取消了对 window.resizeTo 的支持,而且似乎有一段时间确实这么做了。 看
http://kb.mozillazine.org/Resizing_oversize_window#JavaScript_no_longer_allowed_to_resize_windows

您可以在 Firefox 中禁用窗口调整大小:
http://www.howtogeek.com/howto/internet /firefox/disable-web-site-window-resizing-in-firefox/

如果您已启用 JavaScript 窗口调整大小但它仍然不起作用,那么您可能安装了 Firebug。 禁用Firebug并重新启动Firefox,window.resizeTo将再次起作用。
请参阅此处:https://bugzilla.mozilla.org/show_bug.cgi?id= 565541#c47

至于是否应该发生窗口大小调整,我想不出很多情况,但我知道一个,所以我分享一下。 我编写了一个具有可选导航窗格的帮助窗口。 我有一个按钮,允许用户显示/隐藏导航窗格。 当他们显示它时,我为他们调整窗口大小,为导航窗格留出空间。 在这种情况下,它是用户发起的,因此不会惹恼用户。 但是,禁用 resizeTo 会使这种情况变得不可能,从而降低用户体验(在本例中)。 归根结底,在大多数情况下,大多数工具都可以用来做好事,也可以用来做坏事。 人们越体贴,使用酷工具的问题就越少。

Here's some related information that may help users reading this post.

Firefox has been pressured to remove support for window.resizeTo, and it appears for a short while did. See
http://kb.mozillazine.org/Resizing_oversize_window#JavaScript_no_longer_allowed_to_resize_windows

You can disable window resizing in Firefox:
http://www.howtogeek.com/howto/internet/firefox/disable-web-site-window-resizing-in-firefox/

If you've enabled JavaScript window resizing and it's still not working, then you probably have Firebug installed. Disable Firebug and restart Firefox, and window.resizeTo will function again.
See here: https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c47

As for whether window resizing should occur, I can't think of many cases, but I know of one so I'll share it. I code a help window that has an optional navigation pane. I have a button that allows users to show/hide the navigation pane. When they show it, I resize the window for them to allow space for the navigation pane. In this case it's user initiated, so it doesn't annoy users. However, disabling resizeTo would make that impossible and thus diminish the user experience (in this case). What it boils down to in most cases is that most tools can be used for good or bad. The more considerate people are, the less problem there is with cool tools.

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