or with cordova plugin: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-network-information/