With the deprecation of synchronous XMLHttpRequest, I am curious about any potential alternatives to achieve a similar behavior. Non-blocking asynchronous XMLHttpRequests may not always be suitable for specific cases.
I am specifically referring to a scenario where I need to send a POST request to the server when a user clicks on a hyperlink. In this case, using PreventDefault is not an option. By utilizing Synchronous XMLHttpRequest, I can trigger the request through an OnClick event, allowing the browser to continue its default behavior once the request is completed. However, using an asynchronous request could lead to unpredictable outcomes, depending on how quickly the new page loads in relation to the request completion.
Are there any more "modern" approaches to hold off the browser's default behavior until the POST request has been successfully executed?
Many thanks and best regards.