Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

Firefox in windows 11 is not throwing online/offline events

  • Không có trả lời
  • 0 gặp vấn đề này
  • 13 lượt xem
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>
Đính kèm ảnh chụp màn hình

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.