View Full Version : Problem with window.resizeTo

06-15-2010, 07:46 PM
I'm using an onLoad script to resize a browser window for a flash player -

function ResizeOpen(){

Works fine, but in IE & FF it causes second browser windows to open to the same size after it's been called, requiring users to resize the second windows.

Tried using an onUnload with following script -

function ResizeClose(){
window.resizeTo(window.screen.availWidth, window.screen.availHeight)

Doesn't work. They're both in the <body> element -

<body ........ onLoad="ResizeOpen()" onUnload="ResizeClose()">

Any way to make this work?


06-16-2010, 02:46 AM
I've never used window.resizeTo() but it's obviously really simple and nothing looks wrong to me from what you've posted. You say the only problem is that when it does the resize that it opens up 2 more windows. Why on earth would the browser open 2 completely unrelated windows from such a command? You must have other code that runs window.open() that you are accidentally activating... maybe you have code that runs on the window.onResizeEvent event?

Either way, unless I see your site in action with all of it's js, etc then I don't think I can figure out your problem, since like I said, what you've posted looks fine to me.

Course, it won't do any good if you give us a site that has absolutely tons of code to jumble through in order to see how the offending code is actually being activated, and if that's the case you should write up a simple example site if that's possible. But most likely it won't be hard to find how the offending code is being activated and see if there is any other code being ran unintentionally.

06-16-2010, 02:47 AM
*window.onResize event*

my bad :P

06-16-2010, 02:51 AM
Post the rest of your code please. A link is preferred. There is nothing in the code you posted to cause the new windows to open.

06-16-2010, 03:25 AM
IE & FF open into a full (max) window. If a second window is opened from a link (i.e., from a post in this thread), they'll open a second browser window that is not maxed, and has the same dimensions as the last second window that was open - the browser remembers the previous dimensions. It will continue doing this until user manually resizes the window by dragging the borders to full screen, and closing the browser. When the above code opens a small window for the flash player, second windows thereafter will open into the same small window.

I've partially corrected the problem by replacing onUnload with onbeforeUnload. The onbeforeUnload script resets the window dimensions to full screen when the small window closes, and that's what the browser remembers. FF now works correctly, but IE opens second windows into a 3/4 sized window, not full. I believe this is an IE bug, but the result is a big improvement over what I was getting earlier.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum