問題描述
有時(shí),我的應(yīng)用程序中的 Ajax 調(diào)用(通過 JQuery 1.8)卡在待處理"狀態(tài).很長一段時(shí)間(有時(shí)長達(dá) 17 分鐘).我用谷歌搜索過,所有可能的解決方案都不起作用:
Once in a while, my Ajax calls (via JQuery 1.8) in my application are stuck with status "pending" for a long time (sometimes up to 17 minutes). I've googled it and all possible solutions didn't work:
- 我沒有安裝廣告攔截器.
- 我已禁用預(yù)測網(wǎng)絡(luò)操作以提高頁面加載性能"在 Chrome 中標(biāo)記.
- 我還在 Ajax 調(diào)用中添加了一個(gè)查詢字符串以使其唯一(以禁用任何 Chrome 緩存鎖定).
你知道如何解決這個(gè)問題嗎?
Do you have a any idea how to solve this?
在下面的示例中,請(qǐng)求等待了 17 分鐘(通過 Fiddler 驗(yàn)證它僅在 17 分鐘后發(fā)送).
In the example below, the request was pending for 17 minutes (verified with Fiddler that it was sent only after 17 minutes).
GET http://www.mywebsite.com/foo/rest/publishers/1/packages?_=1421584749323 HTTP/1.1
Host: www.mywebsite.com
Connection: keep-alive
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
Content-Type: application/json
Referer: http://www.mywebsite.com/foo/client/home
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,he;q=0.6,ru;q=0.4
Cookie: JSESSIONID=C668509B5AFCDEBE9C9774C4721AFB9D;
aaassz="ddss"
看圖:
推薦答案
我偶然發(fā)現(xiàn)了完全相同的問題.一旦我禁用:
I have stumbled on exactly the same problem. As soon as I disabled:
使用預(yù)測服務(wù)更快地加載頁面
Use a prediction service to load pages more quickly
轉(zhuǎn)到 高級(jí)設(shè)置 -> 隱私 -> ca.第三個(gè)復(fù)選框,一切都開始正常工作.我無法重現(xiàn)該錯(cuò)誤.
Go Advanced Settings -> Privacy -> ca. 3rd checkbox, everything started to work as it should. I was unable to reproduce the error.
jquery/ajax
輪詢器在 Firefox 中完美運(yùn)行.它只是 Chrome - 在 Linux 和視窗.
The jquery/ajax
poller works perfectly in Firefox. It's only Chrome - tested on Linux & Windows.
這不是一個(gè)完美的解決方案,因?yàn)樗粫?huì)影響全球范圍內(nèi)的用戶 - 但也許你和我的情況相同 - 受眾有限.
It is not a perfect solution, as it won't affect users in the global sense - but maybe you are in the same situation as I - limited audience.
這篇關(guān)于Chrome 中 JQuery 停止和掛起的 ajax 請(qǐng)求的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!