How do I close a browser window with HTML code?
Disclaimer: The code and methods on this page only work with Internet Explorer. There is no code and method that works with the latest versions of Google Chrome or Mozilla Firefox due to the browser's programming.
Instructions: Insert the following line of code into the body of your HTML page.
<input type="button" value="Close this window" onclick="self.close()">
This method requires a bit more work, but avoids the "prompting issue" discussed in the previous section.
Step One: Insert the following lines of code into the head of your HTML page.
Step Two: Insert the following line of code into the body of your HTML page.
<input type="button" value="Close this window" onclick="windowClose();">