Name

Window.close( ): close a browser window — JavaScript 1.0:

Synopsis

window.close( )

Description

The close( ) method closes the top-level browser window specified by window. A window can close itself by calling self.close( ) or simply close( ). Only windows opened by JavaScript can be closed by JavaScript. This prevents malicious scripts from causing the user’s browser to exit.

See Also

Window.open( ), the closed and opener properties of Window

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.