我可以调整浏览器窗口的大小吗? [英] Can I resize the browser window?

查看:20
本文介绍了我可以调整浏览器窗口的大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调整浏览器弹出窗口的宽度和高度.我可以设置弹出窗口大小,但是当页面重定向到另一个页面时,我想将适合的窗口大小转换为内容大小.

I want to resize a browser popup window's width and height. I can set the popup window size but I want to convert the window size fit to contents size when a page is redirected to another page.

我试过了:

$(window).width(1000);  // Not working.

我该怎么做?

更新

每个人都告诉我不要这样做.为了找出这是不好做法的确切原因,我询问了 ux.stackexchange.com.

Everybody told me not to do it. To find out the exact reason why this is bad practice, I asked on ux.stackexchange.com.

推荐答案

我找到了这个问题的一些答案.这个问题是重复的.但我会再次回答,因为我会整合它们并添加更多信息.

I found some answers to this question. This question is duplicate. But I'll answer again because I'll integrate them and add some more information.

要调整窗口大小,您只需执行以下操作:

To resize the window, you can simply do this:

window.resizeTo(width, height);

但是这种方法在 Chrome 和 Opera 中不起作用.如何调整 IE 浏览器窗口的大小到 1024 x 768

But this method is not working in Chrome and Opera. How do you resize an IE browser window to 1024 x 768

原因,来自javascriptresizeTo";功能在 Chrome 和 Opera 中不起作用,是:

resizeTo 方法在几个浏览器中默认是禁用的,我知道它也可以在 Firefox 中手动禁用.

The resizeTo method is disabled by default in several browsers, and I know that it can also be manually disabled in Firefox.

它已被广泛滥用,因此大多数浏览器供应商都认为它应该被禁用,或者至少是一个用户可控的选项.

It has been widely misused, so most browser vendors feel that it should be disabled, or at least a user controllable option.

但该方法即使在 Chrome 或 Opera 中也适用于弹出窗口.我想原因是浏览器供应商认为在弹出窗口中可能需要 resizeTo 方法,我认为是这样.

But the method is working on popups even in Chrome or Opera. I guess the reason is that the browser vendors thought the resizeTo method could be needed in popups, and I think so.

为了讨论这个问题,我在 ux.stackexchange.com 上写了一个关于这个问题的帖子.https://ux.stackexchange.com/问题/9903/为什么要调整浏览器窗口的错误做法/9962#9962

To discuss this I made a thread about this issue on ux.stackexchange.com. https://ux.stackexchange.com/questions/9903/why-is-resizing-the-browser-window-bad-practice/9962#9962

我不确定 resizeTo 方法是否在每种情况下都是邪恶的,但我确信使用这种方法时应该小心.

I'm not sure if the resizeTo method is evil in every case but I'm sure that one should be careful when using this method.

这篇关于我可以调整浏览器窗口的大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆