[Solved] Close Browser Window Using Javascript Mozilla | Chrome

Web Browser Window Close from JS

In Google chrome it is very easy to close or exit the chrome from javascript, there is no extra configuration there. Just use like below in your script section

window.top.close();

But in the case of Mozilla Firefox, by default you cannot close a window (if that is not generated by you from the javascript code). There is a default settings in the about:config there named dom.allow_scripts_to_close_windows (default its value is false). We just need to switch it into true.
 

How to Close Window In Mozilla

To enable window closing in Mozilla, just type about:config in the address bar of it. Then there will be confirmation will be displayed asking "Your warranty will be void, do you wish to continue". Just click on the "I'll will be careful, I promise" button. There will showing a list of settings, find dom.allow_scripts_to_close_windows then double click on it. Now the default value will be changed to true.

How to enable window closing from javascript in Mozilla
Enable Closing in Scripts Mozilla
After enabling this, just use below in your scripts for Mozilla browser


window.close();

[Solved] Close Browser Window Using Javascript Mozilla | Chrome [Solved] Close Browser Window Using Javascript Mozilla | Chrome Reviewed by Tech Doubts on 2:03 AM Rating: 5

No comments:

Powered by Blogger.