Internet connection


I want to check internet connection on device, I can’t find any information about it and I have no idea, so can you help me?


As far as I know, it’s actually not any good way to do this using the native api’s. The common pattern seems to do a dns resolve against some site. You can do that by using the Dns class in Uno or just using fetch in javascript with the HEAD method and catch the exception if network is not available.

thank you :slight_smile:

Just to add to this.

When fetching a static resource it get’s cached (and therefore after one successful fetch, will return status == 200 even if the internet connection is down).


Force cache override by appending a random string to the GET / HEAD url.

For example: ?rand=" +

All credits to Uldis

Is there a way these days to get native info from device on connection status? Would love to understand what kind of mobile network the user is connected to. Wifi/Edge/3G/4G and more. And if the phone has internet or not. Combining this information with actual web server polling would be a useful pattern.