Closes the current browser window or HTML Application (HTA).
Returns S_OK if successful, or an error value otherwise.
How a window is closed programmatically determines whether the user is prompted with a confirmation dialog box:
- Invoking the IHTMLWindow2::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 IHTMLWindow2::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.