Reputation: 15965
Is it possible to close a browser window/tab with jQuery/Javascript?
Upvotes: 2
Views: 649
Reputation: 342
try
window.close()
but it works only on tabs you opened with javascript you can't close other tabs by using javascript or jquery
Upvotes: 0
Reputation: 19635
It is possible with the condition that the window/tab was opened via javascript. Otherwise, the user will be presented with a modal confirmation dialog stating that a script is attempting to close the window.
Upvotes: 0
Reputation: 69915
Yes you can close a window
window.close();//This will close the window
But you will get a confirm box while closing it. If the window in opened using javascript window.open() then you will not see this confirm dialog.
Upvotes: 0
Reputation: 1235
window.close(); But this will only close the window opened by the javascript, otherwise a confirm box will appear
Upvotes: 4