Close Tab | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Close Tab

How do you close a tab in html or js? This will work han-in-hand with a confim box.

5th Dec 2016, 2:44 AM
Mƶbius
Mƶbius - avatar
1 Resposta
+ 2
You have to check what the user has pressed: if(confirm("Close Window?")){//a confirm box is shown { //user pressed yes window.close(); //closes the current tab } else { //user pressed no //do something else }
5th Dec 2016, 10:37 PM
Patrick G.
Patrick G. - avatar