-3

This is what I've tried:

<html> <head> <script language="javascript" type="text/javascript"> 
var parentWindow = this;
 function closeWindow() { 
// window.top.close(); this.parentWindow.close(); //window.open('','_parent',''); 
//window.close(); 
// var x=confirm('Are You sure want to exit:'); //if(x) window.close(); /*var childWindow = window.open("GAJANAN", "New Tab Window", "width=700,height=700"); setTimeout(function(){ childWindow.close(); }, 1500);*/ } </script>
 </head> <body>
 <br> <a href="javascript:closeWindow();">Close Window</a> <br><br> <a href="javascript:window.open('','_self').close();">close</a> <br><br><br> <!-- saved from url=(0014)about:internet --> <a href="#" onclick="javascript:window.close();opener.window.focus();" >Close Window - javascript:window.close();opener.window.focus();</a> </body> </html>
Bugs
  • 4,491
  • 9
  • 32
  • 41
Gajanan
  • 31
  • 1
  • 8

1 Answers1

0

You can only close windows/tabs that you create yourself. That is, you cannot programmatically close a window/tab that the user creates.

For example, if you create a window with window.open() you can close it with window.close().

Prerana
  • 44
  • 1
  • 3