久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='Sku4X'></small><noframes id='Sku4X'>

        • <bdo id='Sku4X'></bdo><ul id='Sku4X'></ul>
      1. <tfoot id='Sku4X'></tfoot>
        <i id='Sku4X'><tr id='Sku4X'><dt id='Sku4X'><q id='Sku4X'><span id='Sku4X'><b id='Sku4X'><form id='Sku4X'><ins id='Sku4X'></ins><ul id='Sku4X'></ul><sub id='Sku4X'></sub></form><legend id='Sku4X'></legend><bdo id='Sku4X'><pre id='Sku4X'><center id='Sku4X'></center></pre></bdo></b><th id='Sku4X'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Sku4X'><tfoot id='Sku4X'></tfoot><dl id='Sku4X'><fieldset id='Sku4X'></fieldset></dl></div>

      2. <legend id='Sku4X'><style id='Sku4X'><dir id='Sku4X'><q id='Sku4X'></q></dir></style></legend>

        在 Chrome 中加載 (readyState==3) 時的 XmlHttpRequest.re

        XmlHttpRequest.responseText while loading (readyState==3) in Chrome(在 Chrome 中加載 (readyState==3) 時的 XmlHttpRequest.responseText)
      3. <tfoot id='6pFJo'></tfoot>

            • <legend id='6pFJo'><style id='6pFJo'><dir id='6pFJo'><q id='6pFJo'></q></dir></style></legend>
                <tbody id='6pFJo'></tbody>
                <bdo id='6pFJo'></bdo><ul id='6pFJo'></ul>

                <small id='6pFJo'></small><noframes id='6pFJo'>

                • <i id='6pFJo'><tr id='6pFJo'><dt id='6pFJo'><q id='6pFJo'><span id='6pFJo'><b id='6pFJo'><form id='6pFJo'><ins id='6pFJo'></ins><ul id='6pFJo'></ul><sub id='6pFJo'></sub></form><legend id='6pFJo'></legend><bdo id='6pFJo'><pre id='6pFJo'><center id='6pFJo'></center></pre></bdo></b><th id='6pFJo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6pFJo'><tfoot id='6pFJo'></tfoot><dl id='6pFJo'><fieldset id='6pFJo'></fieldset></dl></div>
                  本文介紹了在 Chrome 中加載 (readyState==3) 時的 XmlHttpRequest.responseText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試通過 ajax(通過 XmlHttpRequest (=xhr) 在 Javascript 中流式傳輸"(從服務器到客戶端).我正在使用中描述的修改后的 handleResponse 函數HTTP Streaming"的跨瀏覽器實現(推)AJAX 模式

                  I am trying to "streaming" (from server to client) in Javascript by ajax (by XmlHttpRequest (=xhr). I am using modified handleResponse function described in Cross-browser implementation of "HTTP Streaming" (push) AJAX pattern

                  function handleResponse() {
                  if (http.readyState != 4 && http.readyState != 3)
                      return;
                  if (http.readyState == 3 && http.status != 200)
                      return;
                  if (http.readyState == 4 && http.status != 200) {
                      clearInterval(pollTimer);
                      inProgress = false;
                  }
                  // In konqueror http.responseText is sometimes null here...
                  if (http.responseText === null)
                      return;
                  
                  while (prevDataLength != http.responseText.length) {
                      if (http.readyState == 4  && prevDataLength == http.responseText.length)
                          break;
                      prevDataLength = http.responseText.length;
                      var response = http.responseText.substring(nextLine);
                      var lines = response.split('
                  ');
                      nextLine = nextLine + response.lastIndexOf('
                  ') + 1;
                      if (response[response.length-1] != '
                  ')
                          lines.pop();
                  
                      for (var i = 0; i < lines.length; i++) {
                          // ...
                      }
                  }
                  
                  if (http.readyState == 4 && prevDataLength == http.responseText.length)
                      clearInterval(pollTimer);
                  
                  inProgress = false;
                  }
                  

                  使用 php 腳本,它會刷新我的數據(沒有 ajax,它確實會在進行時將數據刷新到瀏覽器)

                  With php script, which flushes me data (without ajax it really flushes data to browser while progressing)

                  我在 Firefox 中沒有問題,但是 Google Chrome 和 IE 給我一個空的 responseText 而 xhr.readyState 等于 3.我在互聯網上找到了該問題描述,但它沒有給我任何解決方案.

                  I have no problem in Firefox, but Google Chrome and IE give me an empty responseText while xhr.readyState equals to 3. I found that problem described in the Internet, but it didn't give me any solution.

                  你知道,如何繞過Chrome中的這個實現問題嗎?(w3c 說,在 readyState==3 中 responseText 不能為 NULL - Chrome 實現了這個規則,但只給出了空字符串)

                  Do you know, how to pass by this implementation problem in Chrome? (w3c says, that responseText can't be NULL in readyState==3 - Chrome implemented this rule, but gives only empty string)

                  如果您不知道,您知道某些產品中有什么可行的解決方案嗎?(開源框架、庫等)

                  And if you don't know, do you know any working solution in some products? (opensource frameworks, librararies etc.)

                  非常感謝您的想法.

                  解決方法是創建 iframe,將腳本調用到 iframe 并在此處刷新數據,然后通過 javascript 從 iframe 獲取數據.但這不是 ajax 解決方案.我真的很想看到純 ajax 解決方案.

                  The workaround is in creating iframe, call the script to iframe and flush data here and grab data by javascript from iframe. But this is not ajax solution. I really would like to see pure ajax solution.

                  推薦答案

                  Chrome 存在一個錯誤,即只有在接收到一定數量的字節后才會填充 xhr.responseText.有兩種方法可以解決這個問題,

                  Chrome has a bug where it will only populate xhr.responseText after a certain number of bytes has been received. There are 2 ways to get around this,

                  設置返回的內容類型為application/octet-stream"

                  Set the content type of the return to "application/octet-stream"

                  發送一個大約 2kb 的前奏來準備處理程序.

                  Send a prelude of about 2kb to prep the handler.

                  當 readyState == 3 時,這些方法中的任何一個都應該讓 chrome 填充 responseText 字段.

                  Either of these methods should make chrome populate the responseText field when readyState == 3.

                  另一方面,IE7/8 做不到,你需要借助長輪詢或在 IE8 中使用 XDomainRequest 的跨域技巧,例如 MS

                  IE7/8 on the other hand can't do it, you need to resort to long polling or use the cross domain trick with XDomainRequest in IE8, a la MS

                  這篇關于在 Chrome 中加載 (readyState==3) 時的 XmlHttpRequest.responseText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                • <small id='skKV6'></small><noframes id='skKV6'>

                  • <tfoot id='skKV6'></tfoot>

                      <i id='skKV6'><tr id='skKV6'><dt id='skKV6'><q id='skKV6'><span id='skKV6'><b id='skKV6'><form id='skKV6'><ins id='skKV6'></ins><ul id='skKV6'></ul><sub id='skKV6'></sub></form><legend id='skKV6'></legend><bdo id='skKV6'><pre id='skKV6'><center id='skKV6'></center></pre></bdo></b><th id='skKV6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='skKV6'><tfoot id='skKV6'></tfoot><dl id='skKV6'><fieldset id='skKV6'></fieldset></dl></div>
                          <tbody id='skKV6'></tbody>
                          <bdo id='skKV6'></bdo><ul id='skKV6'></ul>

                        • <legend id='skKV6'><style id='skKV6'><dir id='skKV6'><q id='skKV6'></q></dir></style></legend>

                            主站蜘蛛池模板: 啪啪网页| av片在线观看网站 | 日本在线播放 | 日韩超碰 | 一级毛片大全免费播放 | 国产精品亚洲精品久久 | 四虎永久在线精品免费一区二 | 亚洲午夜精品 | av色站 | 99热热 | 中文天堂在线一区 | 精品国产一区二区三区久久狼黑人 | 日本不卡在线视频 | 91在线观看免费 | 久久综合国产精品 | 日韩一区二区三区在线 | 国久久 | 一区二区三区在线看 | 亚洲视频欧美视频 | 青青青伊人| 求毛片 | 精品一区国产 | 黄色在线播放视频 | 中文字字幕一区二区三区四区五区 | 97人澡人人添人人爽欧美 | 成人自拍av | 亚洲电影专区 | 日韩欧美综合在线视频 | 日韩久久综合网 | 国产成人精品在线 | 国产精品成人久久久久 | 中文字幕亚洲一区二区va在线 | 精品久久久久久久久久久下田 | 91天堂网 | 久草中文在线观看 | 欧美国产一区二区 | 亚洲一区二区在线电影 | 91久久久久久久 | 成人影院av | 久久精品二区 | 久久国产一区二区三区 |