How to make this JavaScript popup window modal?

Brian :

This is working well for me, but I need to make it modal so it doesn't get lost behind the main app screen. Is there a way to easily make this screen modal?

string url = "EditTables.aspx?title=Edit Asset Classifications&prompt=Classification Name&method=GetClassifications&name=ClassificationName&value=ClassificationID";
string script = "window.open ('" + url + "', 'popup_window', 'width=500,height=135,left=200,top=150,scrollbars=0,resizable=no');";
T.J. Crowder :

You can't make the popup modal on modern browsers. (There used to be a different method you could use for popup modals, but it's deprecated now.)

By default, that window should appear in front of the window that opens it. You can also respond to clicks on the opening window's document by calling focus on the window returned by open, to bring that other window to the foreground (stopping when you see the unload event from the popup).

If what you're showing in the modal doesn't have to be a separate window, you might consider not using a separate window at all, but instead using an absolutely-positioned div or similar with an element behind it that covers the entire remainder of the window so that it can prevent clicks and similar from reaching the elements underneath it. But if it has to be a separate window, you don't have much you can do other than the focus thing.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=375687&siteId=1