HTML Button Close Window

http://stackoverflow.com/questions/8057802/html-button-close-window

When in the onclick attribute you do not need to specify is javascript.

<button type="button" onclick="window.open('', '_self', ''); window.close();">Discard/<button>

This should do it. In order to close it your page need to be opened by the script, hence the window.open. Here is an article explaining this in detail: http://www.yournewdesigner.com/css-experiments/javascript-window-close-firefox.html

shareedit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s