In my script, GM_xmlhttpRequest doesn't work, but regular xmlhttpRequest does. (But I need GM_xmlhttpRequest because the call is cross-domain.)
window.onbeforeunload = function (){
try{
details = GM_xmlhttpRequest({
method: "GET",
url: "http://www.example.com",
synchronous: true // this been tried with both possible values
});
console.log(details); // Object {abort: function}
}
catch(e){ // catch is not being triggered
console.log(e);
}
return "dontleave";
}
The same code does exactly what it is expected to in Firefox (AJAX first, then continue).
Regular xmlhttpRequest also does what it should in that spot (but it doesn't allow cross domain calls).
What is wrong?