Browsers implement navigator.online property differently.
In Chrome and Safari, if the browser is not able to connect to a local area network (LAN) or a router, it is offline; all other conditions return true.
In Firefox and Internet Explorer, switching the browser to offline mode sends a false value. Until Firefox 41, all other conditions return a true value; testing actual behavior on Nightly 68 on Windows shows that it only looks for LAN connection like Chrome and Safari giving false positives.
I Would suggest listening to the online event and if you get True then to double sure make an ajax request to any public domain like google or your own
[Based On][1]
[1]: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine