My web application needs to get some data from the server and also open an external application via its protocol handler. Unfortunately it doesn't work anymore in recent versions of Firefox. It seems that as soon as the document location is changed, Firefox cancels the http request as if the user was leaving the page.
The following much simplified code prints "200" in Chrome and Edge but "0" in (recent) versions of Firefox. How is this supposed to be done?
var xhr = new XMLHttpRequest();
xhr.open('GET', '.');
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
console.log(xhr.status);
}
};
xhr.send();
document.location.href = 'myscheme://x.y'