readyState 3中的IE7 / 8 responseText不可用 [英] IE7/8 responseText in readyState 3 not available

查看:119
本文介绍了readyState 3中的IE7 / 8 responseText不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用龙卷风编写了一个应用程序,通过HTTP流媒体支持我网站上的实时更新。它适用于除IE7和IE8之外的所有浏览器。以下是处理HTTP流的代码:

I've written an application with tornado to support real time updates on my website through HTTP streaming. It works in all browsers except IE7 and IE8. Here is the code that handles the HTTP streaming:

... code to create xhr object
xhr.open('GET', 'http://192.168.0.173:8888', true);
xhr.onreadystatechange = function() {
        if(xhr.readyState == 3 && xhr.status==200) {
        try {
            alert(xhr.responseText);
        } catch(e) {
            alert("noo");
        }
    }
}
setTimeout("xhr.send(null);", 1000);

问题是当readyState为3时,xhr.responseText不可用。经过几个小时的google我了解了 IXMLHTTPRequest.responseStream 。我试图使用

The problem is that xhr.responseText is not available when readyState is 3. After a few hours of google I learned about IXMLHTTPRequest.responseStream. I tried to use

xhr = new ActiveXObject("MSXML2.XMLHTTP.3.0");

但结果相同。请求被发送到服务器,readyState为3,但xhr.responseStream不可用。

but with the same result. The request is sent to the server and readyState is 3 but xhr.responseStream is not available.

有什么想法吗?或者,当我检测到IE时,我应该回到长轮询吗?

Any ideas? Or should I fall back to long polling when I detect IE?

谢谢

Henry

推荐答案

如果您再次阅读链接页面;

If you read your linked page again;


相比之下,IXMLHTTPRequest接口的Microsoft XML(MSXML)版本通过responseStream属性公开部分结果, Windows Internet Explorer本机版本未实现。请注意,此行为也与IServerXMLHTTPRequest接口不同,后者为responseBody和responseText提供部分结果。

In comparison, the Microsoft XML (MSXML) version of the IXMLHTTPRequest interface exposes partial results through the responseStream property, which the Windows Internet Explorer native version does not implement. Be aware that this behavior also differs from the IServerXMLHTTPRequest interface, which provides partial results to responseBody and responseText.

也就是说,我想,一种不必要复杂的说法,这件事存在,但我们不这样做。无用的IE。我只是必须实现同样的事情,最终只是回到IE的长轮询。

That is, I guess, one needlessly complicated way of saying, this thing exists, but we don't do it. Useless IE. I just had to implement that same thing and ended up just falling back to long polling for IE.

Dojo基金会使用了Bayeux Cometd。但我相信只有Jetty目前实现了Bayeux协议。

The Dojo foundation has Cometd using Bayeux. But I believe only Jetty currently implements the Bayeux protocol.

总之,IE,DIAF。

So in conclusion, IE, DIAF.

这篇关于readyState 3中的IE7 / 8 responseText不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆