XMLHttpRequest is in the process of being totally removed from browsers. Browsers won't remove this in one shot, but will cut down its implementation gradually.
For now, synchronous AJAX calls will be disallowed in cases when user has already dismissed the page — user closed the page, moved to another page, changed browser tab, or minimized the browser.
Basically synchronous AJAX is not going to work inside unload, beforeunload, pagehide & visibilitychange events.
A synchronous AJAX request is a popular way to send analytics data at the time when user closes the page. However it is a highly inefficient solution.
There are better alternatives to do the same thing — like using a Fetch request with a true "keepalive" flag or sending a Beacon request.