简体   繁体   中英

Check Internet Connectivity in cordova using visual studio

Am using cordova with visual studio 2015

now I am checking internet connectivity

so i tried this reference link

html:

<script src="cordova.js"></script>

In JS:

if (navigator.network.connection.type == Connection.NONE) {
        alert("offline");
    } else {
        alert("online");
    }

error:

Cannot read property 'network' of undefined

How to solve this issue, and how to find the find the internet connectivity. Is this proper way to find the internet connection ?

尝试使用此库,无需任何外部插件,它就可以正常工作: https : //github.com/PixelsCommander/OnlineJS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM