The showModelessDialog dialog box is unique and closes with the parent page. The ios mode dialog box appears.
During website development, forms are often displayed. the pop-up dialog box contains modal and non-modal modes, as shown below:
Mode: window. showModalDialog ()
Non-modal: window. showModelessDialog ()
In addition, the window. open Method and the form of simulating the pop-up box effect through div.
Window. open your own Baidu, learn not deeply; div simulation method is not applicable and, in the pop-up box, some components are incompatible with the parent page components, such as the project where the author is located, jquery on the parent page is incompatible with the js framework of the entire website (of course, it is not simple to replace the $ keyword ). So I chose the window. showModelessDialog () method. However, if you use this method, you may encounter the problem of opening multiple pop-up boxes and not closing the parent page after it is closed. The key to solving this problem is,The window. showModelessDialog () method returns the page object to be opened., You only need to cache this page object. When you open the page again, you can determine the status of this object.
The Code is as follows:
1 if (! ModelessDialog | modelessDialog. closed) {2 modelessDialog = window. showModelessDialog (
This prevents multiple pop-up boxes from being opened.
To disable a child page synchronously with the parent page, you only need to disable the child page in the onUnload of the parent page.
The Code is as follows:
1 // parent page: 2 <body> 3 4 // when the parent page is closed, close and right-click search screen 5 function modelessDialog_Close () {6 if (modelessDialog &&! ModelessDialog. closed) {7 modelessDialog. close (); 8 modelessDialog = null; 9} 10}