Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Problem with window.resizeTo

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

    Code:
    <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 -

    Code:
    <script>
    function ResizeClose(){
    window.resizeTo(window.screen.availWidth, window.screen.availHeight)
    } 
    </script>
    Doesn't work. They're both in the <body> element -

    Code:
    <body ........ onLoad="ResizeOpen()" onUnload="ResizeClose()">
    Any way to make this work?

    Thx.

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    44
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • #3
    New Coder
    Join Date
    Feb 2010
    Posts
    44
    Thanks
    0
    Thanked 3 Times in 3 Posts
    *window.onResize event*

    my bad :P

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •