在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. golang常用模块介绍

    golang模块 一.命令行库Cobra Cobra提供简单的接口来创建强大的现代化CLI接口,比如git与go工具.Cobra同时也是一个程序, 用于创建CLI程序 https://www.jian ...

  2. SpringBoot整合Quartz定时任务 系统job Spring Boot教程 调度任务

    原文地址:https://www.cnblogs.com/allalongx/p/8477368.html 构建工程 创建一个Springboot工程,在它的程序入口加上@EnableScheduli ...

  3. scrapy框架系列 (4) Scrapy Shell

    Scrapy Shell Scrapy终端是一个交互终端,我们可以在未启动spider的情况下尝试及调试代码,也可以用来测试XPath或CSS表达式,查看他们的工作方式,方便我们爬取的网页中提取的数据 ...

  4. AVL树原理及实现 +B树

    1. AVL定义 AVL树是一种改进版的搜索二叉树.对于一般的搜索二叉树而言,如果数据恰好是按照从小到大的顺序或者从大到小的顺序插入的,那么搜索二叉树就对退化成链表,这个时候查找,插入和删除的时间都会 ...

  5. 使用C#开发一个简单的P2P应用

    作者: 刘彦青 本篇文章讨论了一种设计P2P网络应用程序的简单方法. 尽管有许多P2P网络不需要索引服务器或中央服务器,各客户机之间可以互相直接通讯,但下面的图1还是显示了P2P网络的基本工作原理,一 ...

  6. mybatis @Select注解中如何拼写动态sql

    @Mapper public interface DemandCommentMapper extends BaseMapper<DemandComment>{ @Select(" ...

  7. PLSQL Developer连接远程Oracle数据库

    要连接远程数据库,传统的一定可行的方法是在本地装一个oracle.然后使用"Network Configuration Assistant"配置.之后用PL/SQL Dev连接.由 ...

  8. (转)Unity导出Android在高通骁龙800以上CPU概率性崩溃解决方法研究

    Android上的奇葩问题真的是太多了,开始测试反馈说游戏在某些Android手机上随机crash,后来经过详细的测试发现随机闪退的手机都是搭载了高通骁龙800以上的CPU.然后连上真机当crash的 ...

  9. [Algorithm] Check if a binary tree is binary search tree or not

    What is Binary Search Tree (BST) A binary tree in which for each node, value of all the nodes in lef ...

  10. Python 使用pymongo操作mongodb库

    Python 使用pymongo操作mongodb库 2016-12-31 21:55 1115人阅读 评论(0) 收藏 举报  分类: - - - Python(10)  版权声明:本文为博主原创文 ...