I\'m having an issue with the navigator.onLine property.
I\'m running a simple website from a local kiosk running on a WAMP.
On my laptop when I test this it
As Danilo Valente pointed: navigator.onLine property is not trustable,
But NOT every error in ajax response means you are disconnected from the internet! It may be an API error (403,500,404 ....)
If you are using axios, you can distinguish these errors like this:
axios.request(options).catch(function(error) {
if (!error.response) {
// network error (server is down or no internet)
} else {
// http status code
const code = error.response.status
// data from server while error
const response = error.response.data
}
});