onclick close a button code example
Example: how to enter through a button that is closed in a html code
<button type="button"
onclick="window.open('', '_self', ''); window.close();">Discard</button>
<button type="button"
onclick="window.open('', '_self', ''); window.close();">Discard</button>