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.
Javascript – Get request url from xhr object
javascript
Related Question
- Javascript – Encode URL in JavaScript
- Javascript – the JavaScript version of sleep()
- Css – CSS parent selector
- Javascript – Storing Objects in HTML5 localStorage
- Javascript – How to remove a specific item from an array
- Javascript – For-each over an array in JavaScript
- Javascript – How to return the response from an asynchronous call
- Javascript – Why does the JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not
Best Solution
If you are using jQuery, you can make use of the "beforeSend" function in the AJAX request to modify the jqXHR object. I.e.,
The jqXHR object passed to the various callbacks will then have that variable,
jqXHR.requestURL
, which you can access.