I need to close the browser window using the java script.
I have tried using window.close but it is not working.
I have also googled and checked stack overflow for any similar posts. I have also gone through following link but in vain.
Is it possible to close browser window from JavaScript?
What I am trying to do is load a page and on load of the page call a java script method which does window.close
Below is the code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script>
function closeBrowser(){
window.close();
}
</script>
</head>
<body onload="closeBrowser();">
</body>
</html>
It is properly working in IE8 though. Its not working in the fire fox.
And even in IE it gives the alert prompt before actually closing the browser. Can we avoid the alert in IE?
Why it does not work in fire fox?