Chrome: how to close a tab inside a page?

Is there a way to close the Chrome tab on the html page?
What I'm looking for is some kind of javascript that will say: Click here to close the tab!

+4
source share
1 answer

I think you can just use the window.close () function, as when closing a popup or regular window:

http://www.javascript-coder.com/window-popup/javascript-window-close.phtml

Update: This no longer works in newer versions of Chrome. However, by opening a new window, do the following:

<a href="javascript:window.open('foo.html', '_self', '');">Open window</a> 

and using

 <a href="javascript:window.close();">Close window</a> 

in foo.html works for me in Chrome 17. See also http://www.google.com/support/forum/p/Chrome/thread?tid=23c03746e3aa03f9&hl=en .

+1
source

Source: https://habr.com/ru/post/1334504/


All Articles