Window resizing


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Window resizing

  1. #1
    Mike S Guest

    Window resizing

    I'm trying to resize a window to fit the size of an image displayed within
    that window.
    Sometimes the image may be pretty small (40-50 pixels height). The window
    has no scrollbars, no location, ..., no other elements, only the regular
    caption and borders.

    First I opened the window using window.open(...) and I specified the width
    and height the window. Except that the open method has a limitation, one
    cannot make the height of the window under 100 pixels.

    So in the new window opened, I wrote a javascript where I called
    window.resizeTo and/or window.resizeBy to adjust the size of the window, but
    I still cannot make it under 72 pixels height.

    This should run on IE and NN.

    Somebody knows a workaround?

    TIA



  2. #2
    zewsk Guest

    Re: Window resizing


    Ok, the problem is that netscape will not allow windows under a
    certain size (100x100pixels) because they consider it a security risk...
    (a malicious program could lurk in a 1x1 pixel window...)
    The solution is to access the netscape security object.
    Here's the code required:

    netscape.security.PrivilegeManager.enablePrivilege('CanvasAccess');
    your window open statement goes here
    netscape.security.PrivilegeManager.revertPrivilege("CanvasAccess");

    Be sure to have the matching revertPrivilege statement or
    the browser will crash. You should be able to open any size window you
    want. good luck. Unfortunately I don't know the IE DOM, so you're on
    your own. I presume there is some equivalent object to deal with.

    zewsk.


    "Mike S" <m_sarbu@hotmail.com> wrote:
    >I'm trying to resize a window to fit the size of an image displayed within
    >that window.
    >Sometimes the image may be pretty small (40-50 pixels height). The window
    >has no scrollbars, no location, ..., no other elements, only the regular
    >caption and borders.
    >
    >First I opened the window using window.open(...) and I specified the width
    >and height the window. Except that the open method has a limitation, one
    >cannot make the height of the window under 100 pixels.
    >
    >So in the new window opened, I wrote a javascript where I called
    >window.resizeTo and/or window.resizeBy to adjust the size of the window,

    but
    >I still cannot make it under 72 pixels height.
    >
    >This should run on IE and NN.
    >
    >Somebody knows a workaround?
    >
    >TIA
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center