<!doctype html> <html> <head> <meta charset = utf-8> <title> check network </title> <script type = text/javascript charset = utf-8 src = cordova.js> </scrip> <script type = text/javascript charset = utf-8> document.addeventlistener(deviceready、ondeviceready、false); function ondeviceready(){checkConnection(); } // var states = {}; states [connection.unknown] = '不明な接続'; states [connection.ethernet] = 'イーサネット接続'; states [connection.wifi] = 'wifi connection'; states [connection.cell_2g] = 'cell 2g接続'; states [connection.cell_3g] = 'セル3g接続'; states [connection.cell_4g] = 'セル4g接続'; states [connection.none] = 'ネットワーク接続なし'; Alert( '接続タイプ:'+States [NetworkState]); } </script> </head> <body onload = onload()> <p id = props>ダイアログボックスはネットワーク状態を報告します。</p> </body> </html>
phonegap检测网络状态的方法就是小编分享给大家的全部内容了、希望能给大家一个参考、也希望大家多多支持vevb武林网。