I asked how I can resize the browser window with JavaScript. Everybody told me not to do it. Why is this a bad practice?

I think sometimes it can be good. For example, I want to show users a tweeting popup page. After a user tweeted, I want to redirect him to twitter main page to let him verify his tweet. But tweeting page is small and main page should be big. In this case, making the browser window bigger seems good for user. Am I wrong? Then how should I do in this case?


I think I need to make somethings clear.

  1. I also don't want my browser to be resized. Resizing users' browser is usually bad. What I want to know is that there could be some case it can be good.
  2. I also don't like popups. But as @zzzBov said, pop-outs are different. That is used in many websites even in Stack Exchange(You can see share buttons under the favorite button). I don't think it would be better if those buttons were jQuery modal dialog.

And, JavaScript resizeTo function can resize the browser. When I tested that function, it works well in browsers but Chrome. In Chrome, it works just in popups. I might be wrong, but I guess Chrome team also may thought that the resizeTo function would be needed in popups.


Most people just don't want the method resizeTo to be used anytime and anywhere. I think if that method were totally evil and useless, the browsers vendors had already disabled that method, but they didn't.

In Chrome and Opera, the resizeTo method is available just in popups, and in Firefox users can disable it manually. I'm sure that one should be very careful when using the method. But I believe this method can be useful in some case.

  • 23
    Just think about it. Would you like your current window to be resized randomly while surfing the net? Probably no. It is probably not that bad when opening a new window, and then resizing it, for example for sharing links via twitter or facebook. But never the currently used window. Aug 11, 2011 at 11:43
  • 14
    People don't like pop-ups, either. Hence the invention of the pop-up blocker.
    – DA01
    Aug 11, 2011 at 14:26
  • 8
    @DA01, i agree, pop-ups are not ok; pop-outs are ok. The difference for a pop-out is that the user has to explicitly click on a control that is labeled as such or uses a standard popout icon (arrow pointing up and to the right). Gmail uses popouts in a number of places.
    – zzzzBov
    Aug 11, 2011 at 15:13
  • 6
    I dislike both; Javscript/CSS dialogs (contained in the main page, but over the content) are more user-friendly, in my opinion. If you want to open Twitter or whatever, open a new tab. Aug 11, 2011 at 15:36
  • 2
    @zzzzBov I agree that if you are going to create a pop-up of any sorts that creates a new browser window, yes it should be clearly labeled. That said, they still can be annoying for al ot of users...namely those of us that like to manage where each link we click on opens (typically in new tabs). If the UI requires some form of pop-up, then make it on an on-page JS modal window of some sorts.
    – DA01
    Aug 11, 2011 at 18:53

14 Answers 14


I feel like everyone just read the title and not the whole question. He's specifically asking about the case of a popup window.

A very common practice in UI/UX is to use a popup window when the current application is interacting with another one. Think of submitting small bits of information like sharing the current page or even more common, logging into another service.

Flickr does it when signing in with a Google Account and even this page does it when sharing a question.

I would think, that the user would prefer to stay on the current page and have a little window pop up that lets them log into Facebook for example. They can still see they're at the site they want to be at in the background, but just interacting with another one, and then the small window closes when there's a successful submission. Why redirect them to a whole new full window page?

In this case; sizing only the pop up, but not the main screen, is perfectly acceptable. There's no need to have a full screen window when there's only two text fields and a submit button.

  • Resizing current user window = Bad
  • Resizing temporary pop up window to make it less invasive = Perfectly Acceptable
  • Using jQuery UI to create in page pop ups, may be better but how different is that really? (UX wise)
  • Resizing a popup window can resize the default "new window" size. Meaning that while it's not too much of a problem this session, you may find that the next time around, my fine-tuned window size has been replaced with your decision. Less great. It is however a black art maybe, resizing the browser doesn't always get remembered as the new default.
    – Amadiere
    Aug 24, 2011 at 10:41
  • 1
    @Amadiere If that happens, I'd say that this is a problem with the browser, not the website : the browser knows the window has been resized by a script, not the user, so it shouldn't keep those values as default.
    – Julien N
    Feb 1, 2012 at 17:56

You shouldn't do anything that overrides what the user has previously chosen. Your application is hosted inside the browser windows. It doesn't own the browser window therefore it shouldn't do anything to it.

The same logic dictates that you shouldn't override any browser behaviour such as the back button.

In fact you shouldn't force the windows of your own application to change size. The user has chosen the size and placement of the window for their own reasons which you don't know.

The user won't expect your application to change the size or position of the window - therefore it follows the principle of least astonishment to do nothing.

"People are part of the system. The design should match the user's experience, expectations, and mental models."

  • As I commented on my article, what if the window is an instant popup which has certain aim to do something? The appropriate window size is obvious, and the user never need to use the back button. Aug 11, 2011 at 13:12
  • 2
    @Sangdol - the back button was just another example of not taking control of the browser. I'm not 100% sure about resizing a popup window, but on balance I would still say it violates the principle of least astonishment.
    – ChrisF
    Aug 11, 2011 at 13:14
  • +1 for the link to the PoLA article. I've been searching for a term to use for such a rule.
    – JonW
    Aug 11, 2011 at 14:43
  • 2
    @Sangdol Personally, I loathe any kind of popup. That's why since years I'm setting up TabmixPlus to open new "windows" in a new tab instead, and I certainly don't want that to resize my other tabs. Also, what if the user has resized their browser to a size smaller than what you want to resize it to because they're watching a video stream and only browsing en passant? If your popup suddenly blocks their view it's definitely decreasing their willingness to revisit your site Aug 12, 2011 at 6:13
  • Altering the control of the back button actually isn't unacceptable. Gmail and Facebook both do it in several cases where they ajax in new stuff, but want the back button to behave as users expect. I'm pretty sure that just saying "Never ever do this with no exceptions" is always a bad idea. (Hypocrite!). In the askers example, if clicking an action requires a new page, but users don't expect a new page, principle of least astonishment may dictate popping up a new, small window, so the user can see they didn't actually leave.
    – Eric G
    Feb 11, 2013 at 21:38

You're taking control away from the user. For example; If the twitter page changes the browser to a small window and they then change their mind before actually tweeting and choose the 'back' browser button they're then left with a small window and have to sort it out themselves back to a size they want it to be.

It's also unexpected behaviour; you don't want to surprise them by having the window do something they don't expect. Users are suspicious when the browser takes over so you risk them closing it down thinking 'a virus has taken control of my pc'.

  • 6
    +1 for You're taking control away from the user. The user is the pilot, a respectable program would not take the control stick away from the pilot.
    – Lie Ryan
    Aug 11, 2011 at 14:19
  • 1
    +1. Good thing firefox can disable resizing by JavaScript - which is also why you shouldn't even assume a fixed window size in your layout Aug 12, 2011 at 6:13

Don't move my cheese!

I have my windows expertly arranged on my multiple widescreen monitors, so I have a few non-maximise browsers (to avoid wasted space from some sites at the side). The last thing I want to happen is for you to resize my browser and all of its tabs to a size that you feel is appropriate.

Other less web-saavy consumers of your website may be spooked by it doing it I guess, and could possibly keep the window that size forever (as they may be unaware of how to change the size).


If you want to do a popup, consider jquery UI modal dialogs. Same effect, no popup window, no resizing neccessary.

  • What about a popup which is used in this page. If you click the Facebook or Twitter share button you can see the popup. Do you think it should be changed jQuery UI modal dialogs? Aug 11, 2011 at 15:14
  • Facebook extensively uses ajax and jquery-like containers, they don't use new browser window popups at all. Aug 11, 2011 at 15:16
  • @normanthesquid: I think Sangdol is talking about when you click on the FB button on a different website, not on FB itself. Personally, I think it's a very special case, since FB doesn't control the website and therefore can't nor shouldn't it add model dialogs. Aug 11, 2011 at 15:39
  • @Sangdol is referring to the Twitter / FB / LinkedIn buttons at the top left of this very page. They open a new browser window. In this case I think that a smaller window does indeed follow the principle of least astonishment. Aug 11, 2011 at 15:51

Many users have multiple windows open at one time (some on multiple screens), and resizing can really mess with the layout. Additionally, most internet use (at least in my personal experience) invloves multiple open tabs. Resizing the browser window will affect not just your application, but the other tabs in the window as well. Lastly, it's just plain annoying when the browser window suddenly changes on its own.

  • 1
    I have my browsers set to not even allow multiple instances, everything is forced into a tab on the same window. If anyone tried to resize my window I wouldn't be visiting that site anymore.
    – Alex
    Aug 12, 2011 at 0:41

The reason why you must not do it has nothing to do with users owning their webpage rather than the page itself.

If you do, however, you won't just modify the state of your web app. You will modify the state of all web apps that the user has open.

Before browser tabs existed, this was not an issue. Each web app had its own window, so resizing the window did not affect other web apps.

Because of tabs, resizing the window means that other tabs will be resized, too. Apart from a lot of computation from the browser, which may make it hang (indeed, resizing a page causes a recalculation of the render tree, every time the browser has a resize[1]...), it may also annoy the user, because he might have resized the window to fit perfectly on another web app.

[1] The reason I emphasize this is that I once was on a page which found it amusing to slowly resize the window from nearly a dot to fullscreen. That was awful, and certainly not impressive.

  • Thaddee - What you describe is another reason why it is bad practice.
    – gef05
    Aug 11, 2011 at 16:47
  • What I meant was, it wasn't because of some philosophical debate, like Goto. It really hurts users. Aug 11, 2011 at 17:24

Sometimes small windows are required but these should be implemented using javascript or some framework based on it, say jQuery. You should always stick to working within the window provided by the browser and never try to resize it. I would dare to say it is like trying to change the resolution of the desktop because you will resize the window for all the other tabs.

Furthermore, these days you cannot assume your users are using a traditional computer with keyboard and mouse, alt-tabbing and what not. What if a user is accessing your site using an iPad / Android / mobile device. Launching a new window and resizing (not even possible on some platforms) would completely destroy the user experience / flow.

You should treat the window in which your web site/application is loaded as your only available space, and work within its confines.


Personally, if you resize the browser or do anything that gets in my way I will close your page and banlist it on my firewall to make sure I never come across it again, not even by mistake.

"In this case, making the browser window bigger seems good for user." <- Anything that "seems good for the user" is inherently wrong. Let the user choose what's best for them.


My browser can only remember one intermediate size.

I can jump from intermediate to maximized and back, to minimized and back, and maximized->minimized->intermediate. But not between 2 different intermediate sizes.

So if I choosed an intermediate size, and it is some work to adjust my window, and somebody chooses a different size, my work is lost, and I get very angry on the page, forcing me to work more.


The other answers have missed one vital fact: links in a popup can be set to open in the original window! If your popup is loading another page that should be full-screen, you can open it in the window that spawned the popup, and close the popup at the same time. See Example 4 here for details.

It's also worth noting that ignoring size, a popup window is still not the same as a normal browser window. Popups are isolated, plain windows without browser functionality like address bar, toolbars, back/forward buttons and so on. Resizing a popup to a full screen window is not an acceptable replacement for opening a page in a normal window.


Yes, you are wrong.

Imagine I have a video playing on the right on my screen. Imagine your small Twitter window enlarges itself, and it comes in front of the video. What will I do ? First, I will make back the Twitter window small. Then, I will choose to use a Web browser who does not allow pages to do that. Indeed, I have several Web browsers who respect me : they do not allow pages to enlarge themselves. Web browsers will be more and more like this. Users have won. The era of the all-mighty Web page is over.

The window is small. OK. Then there is more content in the window. If the user wants to see the full content, the user decides to enlarge the window. It is easy. There are scrollbars that show the user that there is more content. But the user does what s/he wants. Maybe the user is not interested in seeing more. Maybe the user is not interested at all in this content.

And popup windows are bad. Always. I forbid them all.


It's bad practice when your user is human.

When your user is a virtual framebuffer, it's different. In automated testing we often need to work with windows of specific sizes to ensure that elements and events and interactions are being captured and processed in a consistent manner.

It is extremely inconvenient to get the operating system to change resolution on the framebuffer, you have to leave whatever environment you're working and automating in and move down and trigger automatic commands at operating system level. Much better to simply resize the (virtual) browser window and continue.

Problem is, most browsers don't allow this because it interferes with the "user experience". Which means that users are exposed to non-working sites or sites that don't run at unusual screen resolutions / dimensions / ratios.


Who ever says you should not will wish some day that they could resize, there are way to many good reasons to be taking this away. 1. Opening for it to be used as a form with a relative size to the content. when you can only open it with a link and not window.open 2.window.opeen does it you are not going to take that away, right.

  • Sorry, didn't understand, can you clarify or use some online tool if English is not your main language?
    – Devin
    Oct 9, 2023 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.