Krash Posted June 15, 2010 Share Posted June 15, 2010 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. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 15, 2010 Share Posted June 15, 2010 What do you mean by "causes second browser windows to open?" Since the code that you show doesn't have anything that opens a window, the problem most likely isn't from any of it. Can you post the code that opens the new window? Quote Link to comment Share on other sites More sharing options...
Krash Posted June 16, 2010 Author Share Posted June 16, 2010 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. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 16, 2010 Share Posted June 16, 2010 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") Quote Link to comment Share on other sites More sharing options...
Krash Posted June 17, 2010 Author Share Posted June 17, 2010 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. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 17, 2010 Share Posted June 17, 2010 What do you mean by "open a popup from a url?" How are you doing it now? If you mean from an A link, have you tried it like this? <a href="Javascript:window.open()">Open window!</a> Quote Link to comment Share on other sites More sharing options...
Krash Posted June 18, 2010 Author Share Posted June 18, 2010 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. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 21, 2010 Share Posted June 21, 2010 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? Quote Link to comment Share on other sites More sharing options...
Krash Posted June 21, 2010 Author Share Posted June 21, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.