I successfully developed a Mobile application using Cordova, Onsen UI, and Vue.js. While addressing network connectivity issues, I incorporated the cordova plugin
cordova plugin add cordova-plugin-network-information
For determining the type of connection, I utilized the following code snippet
var network = navigator.connection.type
alert(network);
However, it returned undefined. Upon inspecting navigator.connection
in the console log, I noticed the presence of the following properties
- downlink
- effectiveType
- onchange
- rtt
By using the instruction below
navigator.connection.effectiveType
I was able to retrieve the connection type.
Facing another issue where the effectiveType
property displays 3g/4g when I'm disconnected from the internet.
This raises questions on how to confirm the absence of an internet connection. Any guidance would be highly appreciated.