I’m trying to write a simple javascript(no jquery or any other framework) which should automatically close the browser window or tab (if it’s open in a tab). I found a lot of examples over the internet but I couldn’t find a reliable solution( some of them don’t work with IE) . If it’s not possible to close the window directly without the client action a simple link to click on would be good too . So far I have this
<a href="javascript: self.close()">Close Window</a>
The code you posted will work fine, except you can only close windows that were opened by your script (by
window.open). There’s no way you can close a window/tab that the user manually opened.