I want to close the current browser tab by clicking a button. window.close method does not work.
Asked
Active
Viewed 1.3k times
4
-
i doubt you will be able to do it – Rafay Dec 07 '11 at 07:50
-
2possible duplicate of http://stackoverflow.com/questions/5149552/jquery-not-closing-window – Dec 07 '11 at 07:53
2 Answers
7
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.

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928
-5
-
4Please add an explanation to your answer: **why** could that solve the problem? – fuxia Aug 09 '13 at 21:06