Click here to Skip to main content
15,906,574 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
JavaScript
function fnConfirm()
  {
      var answer = confirm("really want to close the window");
      if (answer) {


          window.close();
      }
      else {

      }


and on close button event
C#
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "xx", "<script>fnConfirm();</script>");


but the problem is that, only confirmation box pop ups and on click ok nothing happens,
and after submitting the solution of this problem please tell me how to close only the Tab in which the window is opened, not browser if there are many tabs opened already.
thanks in advance
Posted

1 solution

i got solution..
problem is not with the code, Mozilla firefox does not allow users to close window on script.
but we can change configuration
1. type about:config in address bar and enter.
2. make sure your "dom.allow_scripts_to_close_windows" is true
if not then change it to true.

now scripts work fine on Mozilla firefox.
 
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