[Vuejs]-Cordova Network Information Plugin doesn't work properly

0👍

Assuming you have properly installed the plugin, here’s the function I use to check if WiFi or data connection is active:

function checkConnection() {
    console.log('checkConnection()');

    if(typeof (window.cordova) === 'undefined') {
        return true; // we are on the browser
    } else if(navigator.connection.type == Connection.NONE) {
        return false; // offline
    } else {
        return true; // online
    }
}

Leave a comment