在PhoneGap应用,或者黑莓Java/HTML混搭应用中,如何使用JavaScript检查Mobile App网络连接状态呢?

  1. <script type="text/javascript">
  2. if (navigator.onLine) {
  3. alert("online");
  4. } else {
  5. alert("offline");
  6. }
  7. </script>
<script type="text/javascript">
if (navigator.onLine) {
alert("online");
} else {
alert("offline");
}
</script>

jQuery Mobile中显示online/offline状态

  1. <div data-role="content">
  2. <button id="home_network_button" data-icon="check">Internet Access Enabled</button>
  3. </div>
<div data-role="content">
<button id="home_network_button" data-icon="check">Internet Access Enabled</button>
</div>
  1. <script type="text/javascript">
  2. if (navigator.onLine) {
  3. } else {
  4. $("#home_network_button").text('No Internet Access')
  5. .attr("data-icon", "delete")
  6. .button('refresh');
  7. }
  8. </script>
  9. </div>
  <script type="text/javascript">
if (navigator.onLine) {
} else {
$("#home_network_button").text('No Internet Access')
.attr("data-icon", "delete")
.button('refresh');
}
</script>
</div>

参考:

navigator.onLine 离线检测

http://mobile.tutsplus.com/tutorials/phonegap/build-an-exercise-tracking-app-geolocation-tracking/

html 5检查Mobile App是否在线的更多相关文章

  1. 优秀前端开发教程:超炫的 Mobile App 3D 演示

    今天,我们想与您分享一个实验性的3D效果.它涉及到一个3D移动设备和一些移动应用程序截图.点击切换按钮时,我们将让移动设备转动并移动每个画面,使我们能看到一个分层的视图.你可能之前没见过这种应用程序演 ...

  2. 学习 Mobile App 网站制作的11个优秀案例

    我喜欢收集美丽的,精心设计的移动应用程序网站.在我看来,为 App 提供一个美丽的网站显示了设计者和开发者对它的用户和产品的关心,除了开发应用程序,他们去加倍努力去促进应用和传播关于它的 App. 我 ...

  3. Ionic – 强大的 HTML5 Mobile App 开发框架

    Ionic 是一个强大的 HTML5 应用程序开发框架,可以帮助您使用 Web 技术,比如 HTML.CSS 和 Javascript 构建接近原生体验的移动应用程序.Ionic 主要关注外观和体验, ...

  4. 20款优秀的国外 Mobile App 界面设计案例

    在下面给大家分享的移动应用程序界面设计作品中,你可以看到不同创意类型的视觉效果.如果你想获得灵感,那很有必要看看下面20个优秀用户体验的移动应用 UI 设计.想要获取更多的灵感,可以访问移动开发分类, ...

  5. Top 6 Programming Languages for Mobile App Development

    Mobile application development industry in the last five years have multiplied in leaps and bounds, ...

  6. Property Finder – a Cross-Platform Xamarin MonoTouch Mobile App

    Developers are now finding themselves having to author applications for a diverse range of mobile pl ...

  7. how to update product listing price sale price and sale date using mobile App

    Greetings from Amazon Seller Support, Thank you for writing back to us. I have reviewed our previous ...

  8. Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development

    Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development If you are consi ...

  9. Azure Mobile App - Custom Authentication

    Custom Authentication: 1. For OLD Mobile Service - https://azure.microsoft.com/en-us/documentation/a ...

随机推荐

  1. 【转】PHP笔试题2010年

    From : http://www.51projob.com/a/PHP/20120905/602.html 下午,还有一场比较大的面试等着我[虽然接到pps的录用电话,可是心里还是想去verycd试 ...

  2. C#自带类库实现邮件发送

    1.首先引入命名空间using System.Net.Mail; 2.将发送的邮件的功能封装成一个类,该类中包含了发送邮件的基本功能:收件人(多人),抄送(多人),发送人,主题,邮件正文,附件等,封装 ...

  3. 检查安装的 DirectX 版本

    https://support.microsoft.com/zh-cn/help/179113/how-to-install-the-latest-version-of-directx DxDiag ...

  4. 关于html+ashx开发中几个问题的解决方法 (转)

    在跟html+ashx打交道的园友们肯定会发现,这种模式虽然优美,但在开发中会遇到一些难处理的地方.我也不例外,下面是自己在实际开发中总结出来的几条经验,希望跟大家分享,更希望得到大家的建议和更好的解 ...

  5. RxJava【过滤】操作符 filter distinct throttle take skip first MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  6. zTree怎么判断树有节点展开或者完全关闭的

    树节点有个open属性,引用API: 记录 treeNode 节点的 展开 / 折叠 状态.1.初始化节点数据时,如果设定 treeNode.open = true,则会直接展开此节点2.叶子节点 t ...

  7. vue里ref ($refs)用法

    ref 有三种用法: 1.ref 加在普通的元素上,用this.ref.name 获取到的是dom元素 2.ref 加在子组件上,用this.ref.name 获取到的是组件实例,可以使用组件的所有方 ...

  8. 强化学习之Q-learning简介

    https://blog.csdn.net/Young_Gy/article/details/73485518 强化学习在alphago中大放异彩,本文将简要介绍强化学习的一种q-learning.先 ...

  9. Spark简介及其在ubuntu下的安装使用

    转:http://blog.csdn.net/pelick/article/details/9888311 Spark概述 Spark是一种与 Hadoop 相似的开源集群计算环境,在性能和迭代计算上 ...

  10. 解决PHP使用CVS导出Excel乱码问题

    在使用PHP生成CVS文件后通过Excel打开发现中文全部变成了乱码,之前在我本地win08通过WPS正常的,但上传到服务器Linux在服务器上测试出现了乱码 一开始以后是Linux的问题但后来测试时 ...