Two related questions:
What are the maximum number of concurrent files that a web page is allowed to open (e.g., images, css files, etc)? I assume this va
For Internet Explorer see this MSDN article. Basically, unless the user has edited the registry or run a 'internet speedup' program, they are going to have a maximum of two connections if using IE7 or earlier. IE8 tries to be smart about it and can create up to 6 concurrent connections, depending on the server and the type of internet connection. In JavaScript, on IE8, you can query the property window.maxConnectionsPerServer.
For Firefox, the default is 2 for FF2 and earlier, and 6 for FF3. See Mozilla documentation. I'm not aware of anyway to retrieve this value from JavaScript in FF.
Most HTTP servers have little ability to restrict the number of connections from a single host, other than to ban the IP. In general, this isn't a good idea, as many users are behind a proxy or a NAT router, which would allow for multiple connections to come from the same IP address.
On the client side, you can artificially increase this amount by requesting resources from multiple domains. You can setup www1, www2, etc.. alias which all point to your same web server. Then mix up where the static content is being pulled from. This will incur a small overhead the first time due to extra DNS resolution.
One interesting way to get around the X connections per server limit is to map static resources like scripts and images to their own domains... img.foo.com or js.foo.com.
I have only read about this - not actually tried or tested. So please let me know if this doesn't work.
The limitiation is usually the web server. It's common that a web server only allows two concurrent downloads per user.
Active scripting engines like ASP.NET only executes one request at a time per user. Requests for static files are not handles by the scripting engine, so you can still get for example an image while getting an aspx file.
Pages often have content from different servers, like traffic measuring scripts and such. As the download limit is per server you can typically download two files at a time from each server.
As this is a server limitation, you can't find out anything about it using javascript.
I know at least in Firefox, this value is configurable (network.http.max-connections
, network.http.max-connections-per-server
, and network.http.pipelining.maxrequests
), so I doubt you'll get a definitive answer on this one. The default is 4, however.
What are you attempting to accomplish?
There is nothing in HTTP that limits the number of sessions.
However, there are configuration items in FF for one, that specifically set how many total sessions and how many sessions to a single server are allowed. Other browsers may also have this feature.
In addition, a server can limit how many sessions come in totally and from each client IP address.
So the correct answer is:
1/ The number is sessions is limited to the minimum of that imposed by the client (browser) and server.
2/ Because of this, there's no reliable way to query it in JavaScript.