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.
open; xhrProto. open = function (method, url) { this. _url = url; return origOpen. apply(this, arguments); };
If you are using jQuery, you can make use of the "beforeSend" function in the AJAX request to modify the jqXHR object. I.e.,
$.ajax({ ... url: "http://some/url", beforeSend: function(jqxhr, settings) { jqxhr.requestURL = "http://some/url"; }, ... }); The jqXHR object passed to the various callbacks will then have that variable, jqXHR.requestURL, which you can access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With