Closing the Browser tab using js or jquery

12,646

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.

Share:
12,646
Rakhitha Nimesh
Author by

Rakhitha Nimesh

Web Developer and part time blogger from Sri Lanka seeking the knowledge in innovative web technologies and projects. I write on my own site and always available to do innovative projects. You can check my plugins at WPExpertDeveloper

Updated on June 27, 2022

Comments

  • Rakhitha Nimesh
    Rakhitha Nimesh almost 2 years

    I want to close the current browser tab by clicking a button. window.close method does not work.

  • fuxia
    fuxia almost 11 years
    Please add an explanation to your answer: why could that solve the problem?