Neo
Neo

Reputation: 16219

how do i close firefox browsers window using javascript?

  function CloseWindow()
  {
        window.close();
  }

The above code is working fine for IE but Firefox does not allows to close browsers window any solution???

Upvotes: 0

Views: 2624

Answers (3)

Vilas Borate
Vilas Borate

Reputation: 1

Step 1 : Type the in address bar as " about:config " and press enter key

Step 2: "i'll be careful , I promise" Click on this button

Step 3: " dom.allow_scripts_to_close_windows;true " Search this line and Double click on it.

Upvotes: -1

Amir Ismail
Amir Ismail

Reputation: 3883

Try to use self object

<a href="javascript:self.close()">Close Window</a>

Upvotes: 2

Pratik
Pratik

Reputation: 30855

similar post answer

function closeWindow() {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
    alert("This will close the window");
    window.open('','_self');
    window.close();
}

closeWindow();

reason For security reasons, your script cannot close a window/tab that it did not open.

The solution is to present the age prompt at an earlier point in the navigation history. Then, you can choose to allow them to enter your site or not based on their input.

Instead of closing the page that presents the prompt, you can simply say, "Sorry", or perhaps redirect the user to their homepage.

Upvotes: 0

Related Questions