在PhoneGap应用,或者黑莓Java/HTML混搭应用中,如何使用JavaScript检查Mobile App网络连接状态呢?
<script type="text/javascript"> if (navigator.onLine) { alert("online"); } else { alert("offline"); }</script>
jQuery Mobile中显示online/offline状态
<div data-role="content"> <button id="home_network_button" data-icon="check">Internet Access Enabled</button> </div>
<script type="text/javascript"> if (navigator.onLine) { } else { $("#home_network_button").text('No Internet Access') .attr("data-icon", "delete") .button('refresh'); } </script></div>
参考:
http://mobile.tutsplus.com/tutorials/phonegap/build-an-exercise-tracking-app-geolocation-tracking/
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow