我正在使用以下内容进行长轮询请求...
$.getJSON(url, function(data) {
...
});
在 30 秒过去或有信息要发送(长轮询)之前,请求不会完成。
问题是 Firefox 是唯一会在底部显示“Waiting for URL...”的浏览器。有什么办法可以防止这种情况发生吗?
我正在使用以下内容进行长轮询请求...
$.getJSON(url, function(data) {
...
});
在 30 秒过去或有信息要发送(长轮询)之前,请求不会完成。
问题是 Firefox 是唯一会在底部显示“Waiting for URL...”的浏览器。有什么办法可以防止这种情况发生吗?
This is pretty bad because some users will just sit there and wait for the page to 'load', and Firefox is not the only browser that does this. Unfortunately, I don't think there is an easy way to fix this without using some fairly exotic techniques. One thing you might try provided the duration is due to server processing time, not data transfer to the client, is using an psuedo-async call. When you get the request, kick off a new thread on the server and return a token, that will clear the message. Every 'x' seconds send the token back to the server to check to see if the request is completed. Just make sure whatever security/authentication methods you need for the current request are replicated on both ends of the async request.