在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. serializeArray()与 serialize()

    serialize()序列表表格内容为字符串,用于 Ajax 请求. serializeArray()序列化表格元素 (类似 '.serialize()' 方法) 返回 JSON 数据结构数据. .s ...

  2. [leetcode]Word Ladder @ Python

    原题地址:https://oj.leetcode.com/problems/word-ladder/ 题意: Given two words (start and end), and a dictio ...

  3. 漂亮的CSS3提交意见输入框样式

    做了个输入框样式,如图: CSS代码如下: <喎�"http://www.2cto.com/kf/ware/vc/" target="_blank" cl ...

  4. windows 使用 xxfpm 解决 php-cgi 进程自动关闭

    windows 下 php-cgi 进程处理一定数量的访问后,就会自动关闭,由于没办法直接让 php-cgi 进程支持更多的访问数量,所以只能启动多个进程来满足需求. xxfpm 是一个可执行程序,它 ...

  5. spark0.9分布式安装

    http://blog.csdn.net/myboyliu2007/article/details/18990277 spark安装包:spark-0.9.0-incubating-bin-hadoo ...

  6. xshell tunnel的使用

    原文:https://www.jianshu.com/p/388a93b1e7f7 https://blog.csdn.net/qq_34039315/article/details/77510923 ...

  7. ASP.NET MVC提交LIST列表到后台接收不到数据

    兄跌 你看到这篇文章的时候已经找到答案了. 我在解决这个问题的端倪的时候已经浪费了我一个下午的休假时间.所以你应该给我一个赞!!! 不废话了上代码: Entity(Model) [Serializab ...

  8. javascript的冒泡排序, 快速排序, 选择排序, 插入排序

    冒泡排序, 最经典的排序, 把比较大的数字往后放, 和选择排序恰恰相反: <!DOCTYPE html> <html lang="en"> <head ...

  9. STL 笔记(四) 迭代器 iterator

    stl 中迭代器能够理解为面向对象版本号的广义指针,提供了对容器中的对象的訪问方法,能够遍历容器全部元素.也能够訪问随意元素.stl 迭代器有下面五种: Input iterators   仅仅读,输 ...

  10. MyBatis - (一) 基本数据操作命令和简单映射

    1. 简单的select映射 <mapper namespace="com.mybatis3.mappers.StudentMapper"> <select id ...