JavaScript - how to disable the minimize button of a popup window using javascript

Asked By biplab saha on 05-Feb-07 09:09 AM
end of post
Sushila Patel replied to biplab saha on 05-Feb-07 09:30 AM

You can use showModalDialog

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodaldialog.asp

From NG the solution offered is as

<extract>you can disable the maximize button by setting the window popup var t
resize=0 and to disable the minimize button set the following in the popup window's body tag onblur="this.focus()"

</extract>



using showModalDialog - sundar k replied to biplab saha on 05-Feb-07 11:49 AM

If you call the function given below from your code, it will open a modal window, which will not have the minimize/maximize buttons, but it does not take care of the close button.

function showWin() {
 
 var newlookup = window.showModalDialog("http://www.yahoo.com",
 "", "","status=0;help=0;dialogHeight=" + 400 + ";dialogWidth=" +600 )
 
}

IE Only Solutions - Robert Stanton replied to sundar k on 05-Feb-07 01:49 PM

Be aware that Modal dialogs only really exist in IE.
You should test if showModalDialog is supported before executing it. If it does not exist then open the window by passing modal=yes into window.open

if (window.showModalDialog) 
   window.showModalDialog(...);
else
   window.open("dialog.html", ..., "width=250px;modal=yes"
   

Re :: Disable minimize button of popup window using javascript - Shailendrasinh Parmar replied to biplab saha on 17-Nov-08 05:03 AM

Hi,

No, you have no control over the minimize button of a new window (unless you're talking about Microsoft specific modal dialogs, in which case you might, I don't use them enough to know one way or another). Quite frankly, you can't be guaranteed anything about your call to window.open() anyway, so trying to control what the user can do with a window that you aren't even sure is the size you want, has the chrome you want or is even open is rather pointless.

Also, the attributes parameter should be a comma-separated list of values with no spaces. Some browsers will not give you the desired attributes if you include spaces in the attributes string.

Hope this helps.