我如何可以检测与AngularJS如果应用程序处于脱机状态? [英] How can I detect with AngularJS if the app is offline?

查看:95
本文介绍了我如何可以检测与AngularJS如果应用程序处于脱机状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在偏远地区的许多客户连接丢失的频繁。我如何检测的JavaScript应用程序离线?这意味着不能达到服务器并加载模板。

We have many customers in remote areas and lost of connectivity is frequent. How can I detect if the javascript app is offline? Meaning cannot reach the server and load the templates.

推荐答案

我终于找到了的jsfiddle这正是这么做的:检查Web应用程序在线。它采用 window.navigator.onLine

I finally found a JSFiddle that does exactly that: Check if the web application is online. It uses window.navigator.onLine.

的jsfiddle: http://jsfiddle.net/rommsen/QY8w2/

JSFiddle: http://jsfiddle.net/rommsen/QY8w2/

来源: https://groups.google.com/d/msg/角/ ZncvSVUc9y4 / S4jH1e_XgGoJ

这篇关于我如何可以检测与AngularJS如果应用程序处于脱机状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆