Reputation: 1441
I want to close the current browser tab by clicking a button. window.close method does not work.
Upvotes: 4
Views: 12800
Reputation: 1038720
You can't close the current browser tab with javascript. It would be annoying for the user if sites start to close themselves like this without the user intent so browsers simply do not allow this. Don't forget that the notion of a browser tab is not defined anywhere in the HTML nor the EcmaScript specifications, some browsers don't even have tabs.
You could of course write a plugin that you will install on your client's browser that will do the job.
Upvotes: 7