www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Methods
 close Method
close Method

Closes the current browser window or HTML Application (HTA).

Syntax

window.close()

Return Value

No return value.

Remarks

How a window is closed programmatically determines whether the user is prompted with a confirmation dialog box.

  • Invoking the window.close method on a window not opened with script displays a confirmation dialog box. Using script to close the last running instance of Windows Internet Explorer also opens the confirmation dialog box.
  • Invoking the window.close method on an HTA closes the application without prompting the user because the HTA is trusted and follows a different security model. For more information on the security model of HTAs, please refer to The Power of Trust: HTAs and Security.

When a function fired by an event on any object calls the close method, the window.close method is implied.

<SCRIPT LANGUAGE="JScript">
function myClose() {
    close();}
</SCRIPT>
<BODY >
Click this page and window.close() is called.
</BODY>

When an event on any object calls the close method, the document.close method is implied.

<BUTTON >
Click this button and document.close() is called.
</BUTTON>

Standards Information

There is no public standard that applies to this method.

Applies To

window
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG