Close browser automatically after the alert

0

How do I make the browser close automatically after the alert?

<html>
<head>
</head>  
<body>
  <div onmouseover="showText();" onmouseout="javascript:alert('my alert');" id="div"></div>
</body>
</html>

function alert(){
  alert("my alert");
}
    
asked by anonymous 23.10.2017 / 18:05

2 answers

2

Try to use:

window.close();

after the alert.

    
23.10.2017 / 18:09
0

You could do something like this:

function alerta(){
alert('my msg');
}
function fechar(){
window.close();
}
#algo{
width: 100px;
height: 100px;
background: darkcyan;
}
<div id='algo' onmouseover='alerta()' onmouseout="fechar()"></div>
    
24.10.2017 / 00:49