Home >Web Front-end >JS Tutorial >JS sample code to close the web page window without prompting_javascript skills
In IE7 and IE8, the current window or tab can be closed using the close() method provided by JavaScript, but an annoying dialog box is prompted. After looking for the code, I can finally close it directly without prompting.
JavaScript code
XML/HTML code
1.
For the parent window to open the child window, click the child window to close, Operations to close the parent window at the same time:
var windowParent = window.opener;
windowParent.opener = null;
windowParent.open('', '_self');
windowParent.close();