If there are no previous history entries, call window.close() on button click. The button text should probably stay the same, because "Close Tab" would only make the user check for possible negative consequences, i.e., the history length that the script already checked, and there should in fact be another tab to go back to.
If there are no previous history entries, call
window.close()on button click. The button text should probably stay the same, because "Close Tab" would only make the user check for possible negative consequences, i.e., the history length that the script already checked, and there should in fact be another tab to go back to.