JavaScript - how to disable minimize button on popup window using window.open

Asked By deepi singh on 04-Nov-10 06:33 AM
Hi,

How to disable minimize button on  popup window using window.open.

this is my below code


Dim script As String

url_string = "Uph_Item_Confirm.aspx?ordersession=" & str

script = "<script>" + vbCrLf

script += "window.open('" & url_string & "','window','width=150px,height=100px,left=600px,top=300px,toolbar=no,menubar=no,resizable=no');" + vbCrLf

script += "</script>"

UI.ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType(), "script1", script, False)



Mitesh Darji replied to deepi singh on 04-Nov-10 06:44 AM
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.

Window Attributes


Below is a list of the attributes you can use:


1. width=300
Use this to define the width of the new window.

2. height=200
Use this to define the height of the new window.

3. resizable=yes or no
Use this to control whether or not you want the user to be able to resize the window.

4. scrollbars=yes or no
This lets you decide whether or not to have scrollbars on the window.

5. toolbar=yes or no
Whether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.).

6. location=yes or no
Whether or not you wish to show the location box with the current url (The place to type http://address).

7. directories=yes or no
Whether or not the window should show the extra buttons. (what's cool, personal buttons, etc...).

8. status=yes or no
Whether or not to show the window status bar at the bottom of the window.

9. menubar=yes or no
Whether or not to show the menus at the top of the window (File, Edit, etc...).

10. copyhistory=yes or no
Whether or not to copy the old browser window's history list to the new window.

All right, here's an example code for opening a new window:

<FORM>
<INPUT type="button" value="New Window!" onClick="window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')">
</FORM>


for more information review this link:

http://www.pageresource.com/jscript/jwinopen.htm
http://www.w3schools.com/jsref/met_win_open.asp


Mitesh Darji replied to deepi singh on 04-Nov-10 06:49 AM
also you can use ModalDialog Method instead of window.open() javascript method

check below link:

http://msdn.microsoft.com/en-us/library/ms536759.aspx
deepi singh replied to Mitesh Darji on 04-Nov-10 07:10 AM
Hi,


we are opening 2 windows simulataneously in text changed event.one is window.open popup and other is third party window.

now the problem is how to hide minmize button in window.open pop up

for tht i replaced my window.open to modal dialog then it is working ...now the probs is my third party page is not opening...

this is my below code:

modal dialog poup

Dim script As String

url_string = "Uph_Item_Confirm.aspx?ordersession=" & str

script = "<script>" + vbCrLf

script += "window.showModalDialog('" & url_string & "','window','dialogWidth:150px;dialogHeight:100px;scroll:no;');" + vbCrLf

script += "__doPostBack('UphItemConfirmWindowPostBack', '');"

script += "</script>"

UI.ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType(), "script1", script, False)


third party window code

Script = "<script>" + vbCrLf

url_string = "http://ep5.eprevue.net/eprevuebroyhill/Redirect.aspx?ordersession=" & globals.UserName & "&action=ConfigureLineItem&SKU=" & ViewState("item") & "&FabSKU=&ID=Broyhill&Key=BBbroyhillsw&email=david@westerntechs.com&password=password"

ClientScript.RegisterStartupScript(Me.[GetType](), "msg", "Addyellow(" & RowNo & ",'" & globals.UserName & "');", True)

Script += "</script>"

UI.ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType(), "script1", Script, False)
----------------------------------------------------------------------------------------------------------------------------------
Add yellow javascript code---------function call in third party code


function Addyellow(i,j)

{

var childWindow = null;

var txtitem = document.getElementById("ctl00_Body_txtItem" +i).value;

var childWindow = window.open('http://ep5.eprevue.net/eprevuebroyhill/Redirect.aspx?ordersession='+j+'&action=ConfigureLineItem&SKU='+ txtitem +'&FabSKU=&ID=Broyhill&Key=BBbroyhillsw&email=david@westerntechs.com&password=password', '_blank');

return true;

}