Online/Offline events work on Chrome but not in Firefox
I am developing an Angular 5 Web App that uploads some files to the server and i need to stop and buffer the upload once the internet connection is down.
Following this link, you can find the Mozilla Firefox support for the navigator.online property that reflects the status of the internet connection.
Still, when i run the live example and i disable my network card, as recommended by the app "Toggle your wifi on/off while viewing this page", nothing happens. I changed to Chrome and it works perfectly. I am using Firefox 58 and Chrome 63.
I have seen some posts discussing the offline mode of Firefox that has to be manually set by the user following settings > more > offline mode . Per spec Firefox considers a Network Status as different from an Internet Connection Status. Still, it is confusing and unexpected behavior.
My questions is: how can I implement a cross-browser light-weight mechanism that checks for internet connection ?
链接地址: http://www.djcxy.com/p/44726.html