This code is actually javascript, but the question comes up often in this forum, and I don't take credit for the solution, but I thought it might be a good place to have it.
Code:
<script type="text/javascript" language="javascript">
function bye() {
self.opener=this;
self.close();
}
</script>
Enjoy!
As per a suggestion, I'll be a bit more explicit... this function should be placed in whichever window it is you want to close, and then be called as a simple
bye();
i.e.
<input type="button" name="close" value="Close the page" onClick="bye();" />
As fair warning, this is not fully javascript compliant, fully compliant browsers will tell you that you can not close a window which you did not open with the script. However, since Microsoft defines it's own standards, this works in IE 6 until they decide to change it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.