Friday, January 21, 2011

Ajax XMLHttpRequest object limit

Is there a security limit to the number of Ajax XMLHttpRequest objects you can create on a single page? If so, does this vary from one browser to another?

  • I don't think so, but there's a limit of two simultaneous HTTP connections per domain per client (you can override this in Firefox, but practically no one does so).

    Marcel Korpel : Nowadays, this limit is higher, e.g. on my current Firefox (3.6.3/Linux) the default number of simultaneous HTTP connections is 6. You can test it with [this little test case](http://www.spasche.net/files/parallel_connections/).
    From Kevin
  • Yes, as Kevin says, HTTP/1.1 specifications say "A single-user client should not maintain more than 2 connections with any server or proxy."

    From fluteflute
  • I've found it easier to pool and reuse XMLHTTPRequest objects instead of creating new ones...

    Marcel Korpel : Agreed, but that doesn't work if you want to have multiple simultaneous requests.
    From FlySwat

0 comments:

Post a Comment