js check if tab is reloading or closing code example Example: javascript close current tab window.close();//closes the current browser tab