开发者

Is it possible to close a window/tab?

开发者 https://www.devze.com 2023-03-26 09:08 出处:网络
Is开发者_开发技巧 it possible to close a browser window/tab with jQuery/Javascript?window.close();But this will only close the window opened by the javascript, otherwise a confirm box will appearYes y

Is开发者_开发技巧 it possible to close a browser window/tab with jQuery/Javascript?


window.close(); But this will only close the window opened by the javascript, otherwise a confirm box will appear


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.


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.


try

window.close()

but it works only on tabs you opened with javascript you can't close other tabs by using javascript or jquery

0

精彩评论

暂无评论...
验证码 换一张
取 消