Jump to content

Browser problem with window.resizeTo


Krash

Recommended Posts

 

I'm using an onLoad script to resize a browser window for a flash player -

 

<script>
function ResizeOpen(){
window.resizeTo(435,475)
window.moveTo(280,140)
}
</script>

 

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 -

 

<script>
function ResizeClose(){
window.resizeTo(window.screen.availWidth, window.screen.availHeight)
} 
</script>

 

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

 

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

 

Any way to make this work?

 

Thx.

 

 

Link to comment
Share on other sites

 

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.

 

 

Link to comment
Share on other sites

That isn't so much a bug as it is a feature. Most (if not all) browsers remember the dimensions of the window when you close it to use for the next time you open it (unless it was maximized when you closed it). Instead of using resizeTo(), try opening the new window with the size already set. With these parameters, the window size won't be saved when you close it:

window.open(url, name, "menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,height=280,width=915")

Link to comment
Share on other sites

I'm trying to set these players up for artists without websites, so they can post a url to the player in a thread, and people on the board can popout the player by clicking on the link.    I haven't come up with a way to open a popup from a url - closest I've gotten is to load a blank page that contains an onLoad that opens the popup, then closes the parent.  This is easy to do in IE, but seems to be impossible in FF.

 

The workaround is to open a new browser window and resize it so it looks like the popup, but it doesn't work the same. I can get the thing to popup correctly, but there are links in the player window (homesite, support forum, etc.) that should open in new, full windows, and that's where I'm having problems.

 

 

Link to comment
Share on other sites

 

The url is posted in a thread on any board (like this one) in url tags, and opens a blank landing page (in my domain) that launches a popup window (also in my domain) with an onLoad script, then closes itself.  Can't get that to work in FF (first window won't close itself), so plan B is to open a new browser window resized to look like the popup, but it doesn't work the same.  IE and FF handle window targeting and resizing quite differently, and this is causing major problems with links in the popup that go to a homesite and support forum.

 

 

Link to comment
Share on other sites

Oh, I see. I didn't realize that you were working cross-domain. I don't think you are going to be able to get sufficient access rights to be able to close a window opened from a different domain. As far as resizing goes, what is the problem with resizing onload? From what I understand, it works how you want except that, once the user closes that window, subsequent windows opened are the same size even if your script isn't run? That shouldn't happen with the current version of IE or FF. What versions are you using?

Link to comment
Share on other sites

 

I fixed the resize problem by running a resize script either onbeforeUnload, or when I open a new window.  Had the basic idea before, but wasn't targeting the windows correctly.

 

I now have a big problem with popup blockers.  The popups I've used previously are opened with onClick, and aren't blocked because they're user requested.  I'm running pretty much the same script, but launching the popup with onLoad, and it's being blocked, apparently because it's not user requested.  :shrug:

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.