JavaScript window.close() close window syntax
window.close is a syntax for closing the browser window. A common application is when a user opens a new window on the original web page through window.open to display part of the web page content or logo, and the user needs to give them a close window after reading it. Link or button ( button ), at this time, you can use JavaScript window.close syntax to create the function of closing the window, but window.close has a feature, that is, in many browser environments, the window can only be used after opening the window independently .close Close.
window.close Close the basic syntax of the window
window.close();
If the web window you open is opened through window.open, then use window.close() to make the close window button, and press the close window button to close it directly, if it is not opened through window.open (for example Direct link open), when you close the window, some browsers will pop up a dialog window asking if you want to close it.
Close the window without popping up the dialog window of inquiry, you can write like this
window.opener=null;
window.close();
JavaScript window.close example
Button type: <input onclick="window.close();" value="Close window" type="button" >
Button type:
Post a Comment
0 Comments