Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

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?

Update

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.

Update2

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 venders 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.

share|improve this question
17  
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. –  Péter Polgár Aug 11 '11 at 11:43
13  
People don't like pop-ups, either. Hence the invention of the pop-up blocker. –  DA01 Aug 11 '11 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 '11 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. –  André Paramés Aug 11 '11 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 '11 at 18:53
show 6 more comments

12 Answers 12

up vote 24 down vote accepted

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)
share|improve this answer
    
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 '11 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 '12 at 17:56
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

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

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.

share|improve this answer
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 '11 at 0:41
add comment

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

share|improve this answer
    
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? –  Sangdol Aug 11 '11 at 15:14
    
Facebook extensively uses ajax and jquery-like containers, they don't use new browser window popups at all. –  normanthesquid Aug 11 '11 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. –  André Paramés Aug 11 '11 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. –  Vian Esterhuizen Aug 11 '11 at 15:51
add comment

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).

share|improve this answer
add comment

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'.

share|improve this answer
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 '11 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 –  Tobias Kienzler Aug 12 '11 at 6:13
add comment

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.

share|improve this answer
    
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. –  Sangdol Aug 11 '11 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 '11 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 '11 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 –  Tobias Kienzler Aug 12 '11 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 '13 at 21:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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