I have a GM_xmlhttpReqeust function setup as follows (simplified version) in my Greasemonkey script.
GM_xmlhttpRequest({
synchronous: false,
method: "HEAD",
url: "http://www.example1.com",
onload: function(response){console.debug(url);},
});
GM_xmlhttpReqeustis called in asynchronous mode in my code.Once accessed,
http://www.example1.comdoes a 302 redirect tohttp://www.example2.comI would like to access the value of the original
urlparameter (http://www.example1.com) insideonloadcallback function.As per
GM_xmlhttpReqeustdocumentation,http://www.example2.comcan be found inresponse.finalUrlinsideonloadcallback.
Could someone please point me to the proper Greasemonkey/JavaScript way?

The
responsepassed toonloadis an object with these key properties:You want
finalUrl, you get it like:Update for revised/clarified question:
In order to get/know the originally requested URL, you must call
GM_xmlhttpRequest()in a closure. Like so: