I have a script that sends an http request to an endpoint and that endpoint redirects to another endpoint.
Eg. http://site/endpoint
redirects to http://site/endpoint2#ABCD
I want to retrieve (in this situation) ABCD
(part after #), but it appears to cut and show only the before # part in req.responseURL
. In the console after enabling showing XHR requests or in network monitor it shows the full url of the request.
How can I retrieve the full address of the redirected site? - How can I retrieve the after # part (Clientside not serverside)?
Example (To show that part after # is cut in req.responseURL
, not actual redirecting)
In web monitor after switching to raw content it also shows that the request was sent to <url>#ABCD
var req = new XMLHttpRequest();
req.open('GET', '/test#ABCD', false);
req.send(null);
console.log(req.responseURL)