使用fetch API来发送一个HTTP请求,然后获取response.url属性

fetch('原始URL')
  .then(function(response) {
    if (response.ok) {
      var redirectedURL = response.url;
      console.log(redirectedURL);
    }
  })
  .catch(function(error) {
    console.log('Error:', error);
  });