JavaScript/ jQuery for Closing Browser FireFox / Chrome / IE

As I need JavaScript / jQuery code for closing browser's ( FireFox / Chrome and IE..)

As I have try with window.close().

But it only work for IE.

Is any other way..?


Solution 1:

This worked for IE and Chrome. (window.close() worked for IE, then win.close for chrome)

<script type="text/javascript">
    function CloseThis() {
             var win = window.open('', '_self');
             window.close();
             win.close(); return false;
    }
</script>

Solution 2:

Can check Browser and write respective script for IE / FireFox

IE---->

window.close()

FireFox --->

var answer = confirm("Do you want to close this window ?");
 if (answer){

netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
    window.close();
 }
 else{
     stop;
 }

Solution 3:

I don't think that is possible as javascript can only interact with the pages rendered by the browser, not the actual browser.