Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

Firefox in windows 11 is not throwing online/offline events

  • Нет ответов
  • 0 имеют эту проблему
  • 13 просмотров
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>
Приложенные скриншоты

Для ответа на сообщения вы должны войти в свою учётную запись. Пожалуйста, задайте новый вопрос, если у вас ещё нет учётной записи.