0

i want to automatically close internet explorer after running php code or after 50 seconds. i got following JavaScript but doesn't work in this case.

<script language='javascript'>
var win = window.open('http://www.google.com',     '1366002941508','width=500,height=200,left=375,top=330');
setTimeout(function () { win.close();}, 10000);
</script>

please help me, i am trying different code doesn't work

best regards,

Leandro Bardelli
  • 10,561
  • 15
  • 79
  • 116
Reel
  • 83
  • 2
  • 15

2 Answers2

0

I hope below code works fine in IE8

<html>
<head>
<script>
function loaded()
{
    alert("Beep!");
    window.setTimeout(CloseMe, 5000);
}

function CloseMe() 
{
    window.close();
}
</script>
</head>
<body onLoad="loaded()">
Hello!
</body>
Leandro Bardelli
  • 10,561
  • 15
  • 79
  • 116
0

You would be able to close a window/tab in IE (or any browser) using javascript but you will not be able to close the application/browser. That being said if you want to automatically close a window after 50 seconds you could use the following:

window.setTimeout(function() {window.close();}, 5000);
Jorge
  • 227
  • 1
  • 3