0

I have two pages(index.html and main.html). this is index.html body tags:

<a href="main.html">main page</a>

and in main page I have a button that when click on that button I want close this window but this function not work! How I can do this? and in console give this warning:

Scripts may close only the windows that were opened by it.
Ghost
  • 85
  • 2
  • 9

2 Answers2

0

This should close the window:

<form>
<input type="button" value="Close Window" onClick="window.close()">
</form>
abagshaw
  • 6,162
  • 4
  • 38
  • 76
0
$('closeButton').click(function(){

  window.close();  //only if you opened the window, and are the owner will this work!  

});
Casey ScriptFu Pharr
  • 1,672
  • 1
  • 16
  • 36