Bot releases are visible (Hide)
更改接口调用方式
time: 时间不设置默认2000
url:不设置默认所有浏览器用online
和offline
事件
var net = onlinenetwork({
"time":1000,
"url":"http://*******.com/ping.php"
})
net.onLineHandler(function(){
console.log("连上了!")
})
net.offLineHandler(function(){
console.log("断开网络!")
})
Published by jaywcjlove over 9 years ago
**必须:**在online.js中设置以下
time
设置轮询时间
url
当url
为空的时候 默认所有浏览器使用 onLine 和 offline事件
- url 不为空的时候 IE 和 Firefox 使用 AJAX 轮询判断网络是否连接
- url 请求的可以是服务器一个空php 等文件
- 文件可以设置头文件,避免轮询跑更多的流量
window.onLineHandler = function(){
console.log("连上了!")
};
window.offLineHandler = function(){
console.log("断开网络!")
};