JS sample code that does not prompt to close the page window directly

  • 2020-03-30 00:54:29
  • OfStack

In IE7, IE8, the use of JavaScript provided by the close() method can be closed the current window or label, but are prompted to hate the dialog box, found the code, finally can be closed without prompt.

JavaScript code


function CloseWin()      
{       
window.opener=null;      
window.open('','_self');      
window.close();       
}    

Example:

XML/HTML code
1. < Input type=button value=" close "onclick="CloseWin()">

For the parent window to open the child window, click the child window to close and close the parent window at the same time:
Var windowParent = window. The opener;
WindowParent. Opener = null;
WindowParent. Open (', 'love');
WindowParent. Close ();


Related articles: