JavaScript get 信息之后获取目标 URL

var xhr = new XMLHttpRequest();
xhr.open('GET', "http://example.com/redirect", true);
xhr.onreadystatechange = function () {
  if (this.readyState == 4 && this.status == 200) {
    console.log(xhr.responseURL);
  }
};
xhr.send();