.close();" to close the specified window."/> .close();" to close the specified window.">

Home  >  Article  >  Web Front-end  >  How to close window in javascript

How to close window in javascript

青灯夜游
青灯夜游Original
2021-04-01 15:03:4610666browse

In JavaScript, you can close the window through the close() method; for example, directly use "window.close();" to close the current window, or you can use "9bf54662ab0eebf19bebd7f4139e648f.close() ;" to close the specified window.

How to close window in javascript

The operating environment of this tutorial: Windows 7 system, ECMAScript version 5, Dell G3 computer.

JavaScript-Close window (window.close)

The close() method is used to close the browser window.

Usage:

window.close();   //关闭本窗口

or

<窗口对象>.close();   //关闭指定的窗口

Description

Method close() will close the top-level browser window specified by window. A window can close itself by calling self.close() or just close().

Only windows opened by JavaScript code can be closed by JavaScript code. This prevents malicious scripts from terminating the user's browser.

Example:

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of How to close window in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn