0
0
0x152016-09-30 20:02:46
Hashing
0x15, 2016-09-30 20:02:46

How to get hash from responseURL after making request with XMLHttpRequest?

Hello.
I'm trying to get the hash that is returned from responseUrl after a request is made.

Principle:
1) There is a request to the server and in case of successful execution of the code on the server, there is a redirect and the output of certain information.
2) The address to which the redirect occurred looks like: https://example.com/index.html#id=123
3) After the request and all the manipulations on the server, the responseURL contains only https://example.com/ index.html

That's exactly what I need to get #id=123.


Perhaps someone knows how to solve this problem?
PS I re-read a lot of articles, I did not find anything worthwhile.

var request = new XMLHttpRequest();
var resUrl = '';
data = {};
method = 'POST';
request.open(method.toUpperCase(), url, true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.onreadystatechange = function() {
        if (request.readyState !== 4) return;
        
        resUrl = request.responseUrl;
};
try { request.send(data); } catch (e) {}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question