Detect browser close event

Vos requêtes concernant Mozilla Firefox, le navigateur Gecko alternatif, ne trouvèrent point de réponses lorsque vous cherchâtes ? Toute l'équipe Geckozone est prête à vous aider.

Modérateurs : nico@nc, Mori, jpj, myahoo

wbali
Arias
Messages : 1
Inscription : 25 déc. 2020, 13:46

Detect browser close event

Message par wbali »

We are working with Firefox Portable ESR 78.6.0 on windows 10 OS
We need to detect the close event to override it, or disable it when the user try to close the browser from the taskbar.

With an older version of Firefox Portable ESR (52.2.0), we used the following code to detect browser closure:

var observerService = Components.classes ["@ mozilla.org/observer-service;1"OUND.getService(Components.interfaces.nsIObserverService);
observerService.addObserver (this, "quit-application-granted", false);
observerService.addObserver (this, "quit-application-requested", false);
observerService.addObserver (this, "browser-lastwindow-close-requested", false);


This code is no longer compatible with the version 78.6.0.

When the user close the browser from the taskbar we need to check:

if (user can close)
close browser
else
do not close the browser

So, is there a way or an add-on to install to disable the closing of the browser from the taskbar?
Or if possible how can we override the browser's code to prevent the user's click on "close window" ?
Avatar de l’utilisateur
Bob49
Animal mythique
Messages : 23550
Inscription : 10 mars 2006, 17:25

Re: Detect browser close event

Message par Bob49 »

Hello.................. ..............! :D

this site is in french, in english, here: http://forums.mozillazine.org/ or https://support.mozilla.org/en-US
Sauvegardez le profil de votre Firefox , avant d'y faire des modifications(install, etc..) ;-)
"Le bonheur est souvent la seule chose qu'on puisse donner sans l'avoir, et c'est en le donnant qu'on l'acquiert." Voltaire
Image
Répondre

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 6 invités