Is there any way to extract the request url from an xhr object? I can see the url in firebug via the channel property but you cant query this using javascript.
With the following hack no wrapper is required:
var xhrProto = XMLHttpRequest.prototype,
origOpen = xhrProto.open;
xhrProto.open = function (method, url) {
this._url = url;
return origOpen.apply(this, arguments);
};
Usage:
var r = new XMLHttpRequest();
r.open('GET', '...', true);
alert(r._url); // opens an alert dialog with '...'