Is there an API that can be used to close a tab programmatically? I know there is the method window.close(), but it can be used only for the windows that were opened by a script using the window.open() method.
What I am trying to do is create a menu button for the users that once clicked will close the current tab or all other tabs if the current tab has been duplicated.
NO it is impossible,
For security reasons, a window can only be closed in
JavaScriptif it was opened byJavaScript.You must edit your code and use
windows.open(), to usewindows.close()method.