問題描述
在 Firefox 3 中,答案是每個域 6 個:一旦對同一域的第 7 個 XmlHttpRequest(在任何選項卡上)被觸發,它就會排隊等待其他 6 個完成.
In Firefox 3, the answer is 6 per domain: as soon as a 7th XmlHttpRequest (on any tab) to the same domain is fired, it is queued until one of the other 6 finish.
其他主要瀏覽器的編號是多少?
What are the numbers for the other major browsers?
另外,是否有辦法繞過這些限制而無需我的用戶修改他們的瀏覽器設置?例如,jsonp 請求的數量是否有限制(使用腳本標簽注入而不是 XmlHttpRequest 對象)?
Also, are there ways around these limits without having my users modify their browser settings? For example, are there limits to the number of jsonp requests (which use script tag injection rather than an XmlHttpRequest object)?
背景:我的用戶可以從網頁向服務器發出 XmlHttpRequest,要求服務器在遠程主機上運行 ssh 命令.如果遠程主機關閉,ssh 命令需要幾分鐘才能失敗,最終阻止我的用戶執行任何進一步的命令.
Background: My users can make XmlHttpRequests from a web page to the server, asking the server to run ssh commands on remote hosts. If the remote hosts are down, the ssh command takes a few minutes to fail, eventually preventing my users from performing any further commands.
推薦答案
您可以用來增加并發連接數的一個技巧是托管來自不同子域的圖像.這些將被視為單獨的請求,每個域都將被限制為并發最大值.
One trick you can use to increase the number of concurrent connections is to host your images from a different sub domain. These will be treated as separate requests, each domain is what will be limited to the concurrent maximum.
IE6、IE7 - 有兩個限制.如果您有寬帶,則 IE8 為 6 - 2(如果是撥號上網).
IE6, IE7 - have a limit of two. IE8 is 6 if you have a broadband - 2 (if it's a dial up).
這篇關于流行的瀏覽器允許多少并發 AJAX (XmlHttpRequest) 請求?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!