Window.open function allowing to resize the widow after setting the resizable property as “0”

北战南征 提交于 2020-01-16 01:17:32

问题


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.


回答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.




回答2:


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");



回答3:


Use: window.resizeTo(width,height)



来源:https://stackoverflow.com/questions/6843249/window-open-function-allowing-to-resize-the-widow-after-setting-the-resizable-pr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!