如果 XMLHttpRequest 对象支持 W3C 进展事件?我的意思是如果将 onload、onprogress、onabort、onerror 等属性设置为某些处理函数如上所述,那些函数调用了这些事件.
Is there any way to check within JavaScript if XMLHttpRequest object supports W3C Progress Events? I mean here if setting onload, onprogress, onabort, onerror, etc. properties to some handler function would have those function called those events, as described.
附加(额外)问题:有没有办法增加 XMLHttpRequest(例如使用一些计时器)来支持这些事件?
Additional (bonus) question: is there a way to augment XMLHttpRequest (e.g. using some timers) to support those events?
旁注:我首先在 XMLHttpRequest 这里
你试过这样吗?
try {
var xhr = new XMLHttpRequest();
if ('onprogress' in xhr) {
// Browser supports W3C Progress Events
} else {
// Browser does not support W3C Progress Events
}
} catch (e) {
// Browser is IE6 or 7
}
我在 Firefox &IE8.Firefox 显示它支持它.IE 表示它不支持 W3C Progress 事件.
I tested this in Firefox & IE8. Firefox shows it supports it. IE says it has no support for W3C Progress events.
这篇关于如果 XMLHttpRequest 对象支持 W3C 进度事件,如何检查 JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
即使在调用 abort (jQuery) 之后,浏览器也会等待Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在调用 abort (jQuery) 之后,浏览器也会等待 ajax 调用
JavaScript innerHTML 不适用于 IE?JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不适用于 IE?)
XMLHttpRequest 无法加载,请求的资源上不存在“AXMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 无法加载,请求的资
XHR HEAD 请求是否有可能不遵循重定向 (301 302)Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 请求是否有可能不遵循重定向 (301 302))
NETWORK_ERROR:XMLHttpRequest 异常 101NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 异常 101)
XMLHttpRequest 206 部分内容XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分内容)