How do I close a browser window with HTML code?
The first method created a button that, when clicked, prompts the user "Do you want to close this window?" If the user clicked OK, the window would close.
<input type="button" value="Close this window" onclick="self.close()">
The second method required a bit more work, but avoided the "prompting issue". The following lines of code were to be inserted into the head of an HTML document:
Then, the following line of code was to be inserted into the body of the HTML document:
<input type="button" value="Close this window" onclick="windowClose();">