Chrome 和其他浏览器会放弃对同步 XMLHttpRequest 的支持吗? [英] Will Chrome and other browsers drop support for Synchronous XMLHttpRequest?

查看:55
本文介绍了Chrome 和其他浏览器会放弃对同步 XMLHttpRequest 的支持吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Synchronous XMLHttpRequest 已被弃用,这意味着对它的支持最终将被删除,这是我在 Chrome 中收到的消息:

Synchronous XMLHttpRequest is being deprecated, meaning support for it will be removed eventually, here is the message I get in Chrome:

主线程上的同步 XMLHttpRequest 已被弃用,因为它会对最终用户的体验产生不利影响.如需更多帮助,请查看 http://xhr.spec.whatwg.org/.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

所以,我的问题是,如果是,主要浏览器(尤其是 Chrome)何时会放弃对同步 XMLHttpRequest 的支持?

So, my question is if, and, if yes, when, major browsers (esp. Chrome) will drop support for Synchronous XMLHttpRequest?

推荐答案

更新:(最后更新于 2019 年 2 月)

Updates: (last updated Feb 2019)

  • Chrome 54 删除微任务期间对同步 XHR 的支持执行.
  • Chrome 80 删除支持在页面关闭期间同步 XHR,企业用户可以在 Chrome 82 之前使用策略标志来解决问题.
  • Chrome 54 removes support of synchronous XHR during microtask execution.
  • Chrome 80 removes supports of synchronous XHR during page dismissal, where enterprise users can workaround using a policy flag until Chrome 82.

恕我直言,现在(比 6 年前)这个功能最终被删除的可能性更高.与往常一样,建议避免同步 XHR 的新用途,并抢先迁移现有的,因为浏览器可以选择在几个月内删除它们.

IMHO, there is now a higher chance (than 6 years ago) that this functionality will eventually be removed. As always, advise avoiding new uses of synchronous XHR, and migrate existing ones preemptively as browsers can choose to remove them with just a couple month's notice.

我没有内幕消息,但这里有一些研究.

I have no insider information, but here is some research.

决定弃用2014 年 2 月.Chrome 宣布它已弃用 同月,但直到 11 月才显示警告2014. Firefox 已于 2014 年 6 月弃用 (Firefox 30).

The decision to deprecate was made in Feb 2014. Chrome declared it deprecated the same month but did not show a warning until Nov 2014. Firefox deprecated it in June 2014 (Firefox 30).

一般来说,网络的重要功能需要时间来迁移.例如,Chrome 已弃用 2013 年 9 月支持 NPAPI.2015 年 4 月(Chrome 42)默认禁用,并计划在 2015 年 9 月完全拆除.

In general, important features for the web take time to migrate. For example, Chrome deprecated NPAPI support in Sep 2013. It is disabled by default in April 2015 (Chrome 42), and is scheduled for complete removal in Sep 2015.

在这种情况下,ExtJS 仍然 使用此功能进行模块加载.其他模块在 unload 事件中使用它来 ping 服务器,但 beacon 替代技术远未准备好迎接黄金时段.还有更多令人信服的用例.

In this case, ExtJS still uses this feature for module loading. Other modules use it inside an unload event to ping the server, but beacon replacement technology is far from ready for prime time. There are some more compelling use cases.

大约 2.5% 的网站(更新:降至 0.8% in Oct 2017) 仍在使用同步 XMLHttpRequest.它看起来不会很快消失.

Roughly 2.5% of websites (Update: dropped to 0.8% in Oct 2017) are still using synchronous XMLHttpRequest. It does not look like it will go away any time soon.

这篇关于Chrome 和其他浏览器会放弃对同步 XMLHttpRequest 的支持吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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