Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii
i want to close the browser on click the button
i used this function window.close()
it only work in ie not work in chrome, fire fox
so any one have any idea to close the browser in fire fox and chrome on button click

thanks in advance
Posted

try with this..

JavaScript
function closePage()
{
   self.close();
}


hope it works..
 
Share this answer
 
Yes. it is wellknown that directly window.close() is not working in other browser except IE
you need to use following javascript code

JavaScript
function CloseWindow()
{
  window.top.opener = null;
  window.close();
}
 
Share this answer
 
please use below code:

C#
function closing() {
var answer = confirm("Do you wnat to close this window ?");
    if (answer){
        netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
        window.close();
    }
    else{
        stop;
    }
}
 
Share this answer
 
Use
HTML
<input id="btnCls" type="submit" class="btn" title="Click here to close the window." value="Close Window" onclick="window.close()"
							onmouseover="this.className='btnOnMseOvr'" onmouseout="this.className='btn'" onmousedown="this.className='btnOnMseDwn'">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900