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?
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
1. Open Chrome browser 2. Go to chrome://flags/#allow-sync-xhr-in-page-dismissal 3. Change the drop-down selection from “Default” or “Disabled” to “Enabled”.
Feature: Disallow sync XHR in page dismissal Chrome now disallows synchronous XHR during page dismissal when the page is being navigated away from or closed by the user. This involves the following events (when fired on the path of page dismissal): beforeunload, unload, pagehide, and visibilitychange.
The sync-xhr policy controls whether synchronous requests can be made through the XMLHttpRequest API. If disallowed in a document, then calls to send() on XMLHttpRequest objects with the synchronous flag set will fail, causing a NetworkError DOMException to be thrown.
Updates: (last updated Feb 2019)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With