Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

Firefox in windows 11 is not throwing online/offline events

  • Keine Antworten
  • 0 haben dieses Problem
  • 13 Aufrufe
more options

I have a component that depends on browser events for online/offline events to let know the user when he is disconnected from the activity.

I was checking on firefox, and for some reason Im not able to see the event been emitted when disabling the network (I did test it, turn it the wifi on/off).

in the image , there is side by side with chrome and firefox, so I know my event listener works, but doesnt seems like firefox is sending the events,

I have a js using same examples from the documentation,

has someone else notice this? , or is some sort of settings in firefox?, according to the documentation it should be supported by default,

my poc code->

<title>Online Offline</title> <script type="text/javascript"> console.log(" ******** Online Offline in real time **********"); const handlerOnline = async () => { console.log("online handler :: ", new Date().toISOString()); }; const handlerOffline = async () => { console.log("offline handler :: ", new Date().toISOString()); }; window.addEventListener("online", () => handlerOnline(), false); window.addEventListener("offline", () => handlerOffline(), false); window.document.addEventListener("online", () => handlerOnline(), false); window.document.addEventListener("offline", () => handlerOffline(), false); window.onoffline = (event) => { console.log("1:: The network connection has been lost."); }; window.ononline = (event) => { console.log("A:: online"); }; window.addEventListener("offline", (event) => { console.log("2:: The network connection has been lost."); }, false, true); window.addEventListener("online", (event) => { console.log("B:: online"); }, false, true); window.addEventListener("offline", (event) => { console.log("3:: The network connection has been lost."); }); </script>

I have a component that depends on browser events for online/offline events to let know the user when he is disconnected from the activity. I was checking on firefox, and for some reason Im not able to see the event been emitted when disabling the network (I did test it, turn it the wifi on/off). in the image , there is side by side with chrome and firefox, so I know my event listener works, but doesnt seems like firefox is sending the events, I have a js using same examples from the documentation, has someone else notice this? , or is some sort of settings in firefox?, according to the documentation it should be supported by default, my poc code-> <!doctype html> <html> <head> <title>Online Offline</title> </head> <script type="text/javascript"> console.log(" ******** Online Offline in real time **********"); const handlerOnline = async () => { console.log("online handler :: ", new Date().toISOString()); }; const handlerOffline = async () => { console.log("offline handler :: ", new Date().toISOString()); }; window.addEventListener("online", () => handlerOnline(), false); window.addEventListener("offline", () => handlerOffline(), false); window.document.addEventListener("online", () => handlerOnline(), false); window.document.addEventListener("offline", () => handlerOffline(), false); window.onoffline = (event) => { console.log("1:: The network connection has been lost."); }; window.ononline = (event) => { console.log("A:: online"); }; window.addEventListener("offline", (event) => { console.log("2:: The network connection has been lost."); }, false, true); window.addEventListener("online", (event) => { console.log("B:: online"); }, false, true); window.addEventListener("offline", (event) => { console.log("3:: The network connection has been lost."); }); </script> </html>
Angefügte Screenshots

Sie müssen sich mit Ihrem Benutzerkonto anmelden, um auf Beiträge zu antworten. Bitte stellen Sie eine neue Frage, wenn Sie noch kein Benutzerkonto haben.