更改offline.js中允许的服务器响应时间
Change time allowed for server response in offline.js
我在一个移动web项目中使用offline.js
。在我运行的特定环境中,该脚本在报告与服务器的连接丢失时似乎有点过于热心。如何修改它以使服务器有更长的响应时间?
尝试用所需的xhr
设置Offline.options
中的检查:
Offline.options = {
checks : {
xhr : {
url : function () {
return "/favicon.ico?_=" + ((new Date()).getTime());
},
timeout : 10000, // change this to the timeout you need
type : 'HEAD'
}
}
};
检查源代码第28行中的默认值。您可以在文档中的Checking头中看到设置检查的方法。
考虑一下:
选项(任何选项都可以作为函数提供),默认值:
{ // Should we check the connection status immediatly on page load. checkOnLoad: false, // Should we monitor AJAX requests to help decide if we have a connection. interceptRequests: true, // Should we automatically retest periodically when the connection is down (set to false to disable). reconnect: { // **How many seconds should we wait before rechecking**. initialDelay: 3, // **How long should we wait between retries**. delay: (1.5 * last delay, capped at 1 hour) }, // Should we store and attempt to remake requests which fail while the connection is down. requests: true, // Should we show a snake game while the connection is down to keep the user entertained? // It's not included in the normal build, you should bring in js/snake.js in addition to // offline.min.js. game: false }
相关文章:
- 带Jquery的wep API,加载资源失败:服务器响应状态为404(未找到)
- 如何在 http 上调用 end().服务器响应对象
- 将服务器响应格式化为人类可读
- 尝试获取服务器响应
- 如何在 Javascript 函数中拦截 Web 服务器响应
- 如何从服务器响应中显示phonegap中的图像
- Nodejs-websocket:如何在没有服务器响应的情况下连续发送客户端消息
- 正在分析Meteor中的错误服务器响应
- 如何用java计算网站的响应时间
- 正在从LWIP服务器响应中检索16位整数
- 同步客户端和服务器端时间
- 可以´t从对象XMLHttpRequest获取服务器响应
- 试图理解返回javascript方法的服务器响应
- 如何减少 webpack 开发服务器重建时间
- AJAX 中的常见服务器响应页原因
- 节点服务器响应错误: process.nextTick(function(){throw err;});.
- GO 中的长时间轮询,服务器响应不当
- REST API测量服务器端响应时间(性能)
- 更改offline.js中允许的服务器响应时间
- 正在测量服务器响应时间(客户端)