tags:

views:

295

answers:

3

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?

A: 

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).

Kevin
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/).
Marcel Korpel
A: 

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."

fluteflute
A: 

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

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