26

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

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/.

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

halfer
  • 19,824
  • 17
  • 99
  • 186
mikhail-t
  • 4,103
  • 7
  • 36
  • 56
  • You're unlikely to get an authoritative answer here, but you can read about the deprecation policy for Blink () and watch blink-dev for deprecation discussions. – smorgan Jun 29 '15 at 04:19

1 Answers1

16

Updates: (last updated Feb 2019)

  • 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.

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.

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).

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.

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.

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.

Alan Tam
  • 2,027
  • 1
  • 20
  • 33
  • Thank you for the research, I've read through the discussions and there is indeed no direct evidence suggesting that it'll be removed anytime soon, especially considering number of sites and technologies removal of the feature would affect. However, I'd cross my fingers for it to stay functional long enough :) – mikhail-t Jun 30 '15 at 14:24
  • 3
    This warning was seen in Chrome developer tools by one of our developers today: `Invoking 'send()' on a sync XHR during microtask execution is deprecated and will be removed in M53, around September 2016. See https://www.chromestatus.com/features/5647113010544640 for more details.` – stevenghines Jul 07 '16 at 23:13
  • I think that the "Updated" link that you mention @alan-tam refers to using synchronous XHR in a specific context, called microtasks. Microtasks are a special type of code http://stackoverflow.com/questions/25915634/difference-between-microtask-and-macrotask-within-an-event-loop-context so synchronous XHR is not being removed in general. The WHATWG group discussion does not suggest it's removal here https://github.com/whatwg/xhr/issues/20 – Colin D Jul 26 '16 at 22:14
  • It's official version 80 and above will disallow synchronous XMLHTTPRequest() in Page Dismissal – S A Feb 06 '20 at 15:47
  • 1
    Still not disabled for me. July 2021 using Chrome v91: [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. – Phil Jul 06 '21 at 15:54