ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox in windows 11 is not throwing online/offline events

  • ما من ردود
  • 0 have this problem
  • 13 views
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>
Attached screenshots

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.