1

When I try to call a URL as a pop-up window through JavaScript, after loading the pop-up window I am able to re-size the window by mouse dragging even after I set the resizable property as "0". Code:

        <script type="text/javascript">
        function poponload()
        {
            mywindow = window.open("factory.php?content=con1", "mywindow", "location=1,status=1,scrollbars=0,width=300,height=300,resizable=0");
            mywindow.moveTo(150, 150);
        }
    </script>

Please clarify if I made any mistake in the code.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Able Alias
  • 3,824
  • 11
  • 58
  • 87
  • 1
    Possible duplicate of http://stackoverflow.com/questions/1715201/how-can-we-disable-resizing-of-new-popup-window-in-firefox – DhruvPathak Jul 27 '11 at 11:12

3 Answers3

4

The following code opens a window with menu bar. The window is re-sizable and is having 350 pixels width and 250 pixels height.

window.open ("http://www.google.com","mywindow","menubar=1,resizable=1,width=350,height=250");
BALKANGraph
  • 2,031
  • 1
  • 15
  • 16
3

Use: window.resizeTo(width,height)

Ahsan Rathod
  • 5,465
  • 2
  • 21
  • 25
1

Modern day browsers can block window.open settings. There are no ways to override it unless you manually go to the user's computer and uncheck the checkbox for them.

Pop up windows should be avoided in this day and age. Modal layers placed on the page that are updated with Ajax or iframes can do the same thing and have no size, menubar, and other restrictions placed on them.

cmbuckley
  • 40,217
  • 9
  • 77
  • 91
epascarello
  • 204,599
  • 20
  • 195
  • 236
  • ok, thanks for the useful information, i will check with Ajax and iframe. – Able Alias Jul 27 '11 at 11:54
  • Your last sentence seems to be to be contradictory. By its nature, pop-up window is _not_ modal, and that is necessary in certain cloud-based applications. In our case, we explicitly state in the requirements that users _must_ allow pop-up windows, at least selectively. – David A. Gray Dec 22 '22 at 04:33
  • @DavidA.Gray After 11 years I still stand by that statement. – epascarello Dec 22 '22 at 13:04
  • Please feel free to stand away. I have two demonstrably practical use cases for pop-up windows, both involving the need to display windows alongside our commercial SaaS application. The first use case is displaying a video player alongside a list of events that occurred during the time when it was recorded, allowing users to click links in the list to advance the video to the corresponding point in time. Likewise, we display transcripts in the same manner so that they can be viewed alongside the activity list. Modal wouldn't cut it in either case. – David A. Gray Dec 26 '22 at 05:29