Remember "asp.net AJAX Under the Hood secrets"? This is the only article I've recommended on my blog (but it's more likely to be a whim). In this article, Omar Al Zabir presents some of his experiences in using ASP.net ajax. One of the things that is mentioned here is that Browsers do not respond when the than two calls in queue. To put it simply, in IE, if more than 22 connections are established in the connection state, but no connection succeeds (no problem after the connection succeeds, even when the data is transferred), the browser stops responding to other actions, such as clicking on the hyperlink for page jumps, The browser will not respond to user actions again until there are no more connections than the two connections you are trying.
This problem generally requires 3 conditions:
Too many connections are established at the same time, for example, there are many modules on a portal that request server-side data at the same time.
The response is slow, it takes a long time to initiate a connection from the browser to a server-side response connection.
Use IE browser, whether IE6 or IE7 will this problem, and Firefox is all right.
In the IE7 incredibly still have this bug, it is really sad to laugh and cry. But we have to solve this problem, don't we?
Write code to maintain a queue
As with the article asp.net AJAX Under the Hood Secrets, the easiest solution is to write code to maintain a queue. This queue is very easy to write and the code is as follows:
Requestqueue.js
if (!window.Global)
{
window.Global = new Object();
}
Global._RequestQueue = function()
{
this._requestDelegateQueue = new Array();
this._requestInProgress = 0;
this._maxConcurrentRequest = 2;
}
Global._RequestQueue.prototype =
{
enqueueRequestDelegate : function(requestDelegate)
{
this._requestDelegateQueue.push(requestDelegate);
this._request();
},
next : function()
{
this._requestInProgress --;
this._request();
},
_request : function()
{
if (this._requestDelegateQueue.length <= 0) return;
if (this._requestInProgress >= this._maxConcurrentRequest) return;
this._requestInProgress ++;
var requestDelegate = this._requestDelegateQueue.shift();
requestDelegate.call(null);
}
}
Global.RequestQueue = new Global._RequestQueue();