跨浏览器是否为READYSTATE_LOADED? [英] Is READYSTATE_LOADED across browsers?

查看:44
本文介绍了跨浏览器是否为READYSTATE_LOADED?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很长时间以来一直使用valums文件上传器: https://github.com/valums/文件上传器

I have been using valums file uploader for a long time: https://github.com/valums/file-uploader

我遇到的一个问题是,它从未真正达到100%的onProgress.

One problem I've had is that it never really hits 100% onProgress.

文件上传完毕后,不会再触发xhr.upload.onprogress.我得到的下一个ping是readyState 4处的完成.

Once the file is done uploading, xhr.upload.onprogress is not fired anymore. The next ping I get is the completion one at readyState 4.

这是因为一旦100%发生,请求完成之前,我的服务器上就会进行处理.因此,用户确实会看到类似98%的内容,然后是请求的挂起"完成,然后是100%之后的完成"状态.

This is because once 100% happens, there is processing on my server before the request completes. So the user really sees something like 98% followed by a "hang" of the request completing and then the "done" state after 100%.

readyState 2是:

readyState 2 is:

READYSTATE_LOADED(2)调用了send方法.没有数据可用.

READYSTATE_LOADED (2) The send method has been called. No data is available yet.

那时在UI中启动我的处理状态是否可靠?

Would it be reliable to start my processing state in the UI at that moment?

注意,我很好奇这是否也可以在IE中使用,尽管上载程序在IE中可以正常发布,所以我们永远都没有进度条.

Note I'm curious if that would work in IE as well, although the uploader does a normal post in IE so we never have a progress bar for them.

推荐答案

从Quirksmode:

From Quirksmode:

load 事件而言,

Explorer有一点意义 readystatechange 事件的子集.页面包含以下内容时触发 load 已完全加载,这相当于说 readyState 是4:已完成.

Explorer has a point in so far as the load event can be seen as a subset of the readystatechange event. load fires when the page has been loaded completely, which is equivalent to saying the readyState is 4: completed.

...

[但是,E] xplorer不支持 xmlhttprequest 上的 load 事件.我们已经知道这一点,但我们应该意识到它甚至不允许您设置事件处理程序,因为它只允许非常有限的一组 xmlhttp 对象上的属性.

[However, E]xplorer doesn't support the load event on xmlhttprequests. We already knew this, but we should realize it doesn't even allow you to set the event handler, since it allows only a very limited set of properties on the xmlhttp object.

Opera中仍然缺少 event 对象,尽管Mozilla中没有.

The event object is still missing in Opera, though not in Mozilla.

http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r_2.html

这篇关于跨浏览器是否为READYSTATE_LOADED?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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