jQuery有pcated同步XMLHTT prequest德$ P $ [英] jquery has deprecated synchronous XMLHTTPRequest

查看:111
本文介绍了jQuery有pcated同步XMLHTT prequest德$ P $的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

和许多人一样,我的网站正在使用jquery。当我打开的开发人员工具,我看到一个警告,指出XMLHTT prequest是

Like many others, my website is using jquery. When I open the developer tools, I see a warning that says that XMLHTTPRequest is

德precated由于其有害影响到最终用户的体验。

deprecated because of its detrimental effects to the end user's experience.

我去和阅读文档的一部分,但它是相当的技术。有人可以解释从XMLHTT prequest深入浅出转移到WHATWG的后果?它说,它发生在2012年。此外,该文件说,工人外同步XMLHtt prequest是从网络平台移除的过程中,当发生这种情况,如果一个用户代理让他们在服务,做自己需要修改现有的code?

I went on and read part of the documentation, but it was fairly technical. Can someone explain the consequences of shifting from XMLHTTPRequest to WHATWG in simple terms? It says it happened in 2012. Also, the documentation says that Synchronous XMLHttpRequest outside of workers is in the process of being removed from the web platform, when that happens, if a user agent had them in a service, do they need to modify their existing code?

推荐答案

要避免此警告,不要使用:

To avoid this warning, do not use:

async: false

在任何你的 $。阿贾克斯()通话。这是唯一的功能 XMLHtt prequest 这是德precated。

in any of your $.ajax() calls. This is the only feature of XMLHttpRequest that's deprecated.

默认值为异步:真正的,所以如果你从来不使用这个选项在所有的,你的code应该是安全的,如果该功能是以往任何时候都真的删除(它可能不会 - 这可以从标准中删除,但我敢打赌,浏览器将继续支持它多年)

The default is async: true, so if you never use this option at all, your code should be safe if the feature is ever really removed (it probably won't be -- it may be removed from the standards, but I'll bet browsers will continue to support it for many years).

这篇关于jQuery有pcated同步XMLHTT prequest德$ P $的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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