Tag Archives: Closing browser window or tab in Mozilla/Firefox

Closing browser window or tab in Mozilla/Firefox

Hi All,

Sometime we face the problem in closing a window/tab in Mozilla Firefox. The reason is that Firefox configuration doesn’t allows users to close active tabs or windows which are not opened by the script. The script means here refers to the pop up windows, opened using “window.open()” method.

Below I will share a very tricky steps to do that.

Steps:
–          Open Mozilla
–          Type “about:config” in address bar
–          You will see a list of some configurations
–          Search for “dom.allow_scripts_to_close_windows” and toggle to “true”, by default value will be “false”

Now create one HTML page, and add the below java script method to close the window.

<script>

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

</script>


Thanks
R Vashi