I want to reload the current page with javascript if a specific url is doing a redirection.I don't need to know the redirection url.The xhr request is being performed and i do get 302 redirect when i inspect the request but my specific redirection isn't happening.
var xhr = new XMLHttpRequest();
xhr.open('HEAD', 'https://www.filterbypass.me/s.php?k=BbrSU%2F%2F39m5gKhLDr31ZqjKYgrAdALscySz%2B6YarDYTH5G9hSDc%2B&b=4&f=norefer');
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 301 || xhr.status == 302) {
//url expired , reload
console.log('perform redirection');
window.location.replace('https://www.google.com');
}
}
};
xhr.send();
I don't see the console.log and i already tried with xhr.readyState == 2
.