The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,835 other subscribers

Posts Tagged ‘763’

Some links on finding the redirection target of a URL from within a web-browser

Posted by jpluimers on 2026/08/26

Likely what I want is not possible because of CORS or CSP (both security features, often mixed up in writings), but just in case below are some links I found.

The problem at hand was that I wanted to use the functionality of a site like [Wayback/Archive] Redirect Checker | Check your Statuscode 301 vs 302, but on the client side because sometimes redirects depend on locality (for example, but not limited to, AliExpress sites).

Thinks like these fail with CSP errors like Refused to connect to 'https://t.co/Ui4Wmesq1j' because it violates the following Content Security Policy directive: "connect-src chrome://resources chrome://theme 'self'".:

var xhr = new XMLHttpRequest();
xhr.onload = function() {
  if (this.status < 400 && this.status >= 300) {
    console.log('request redirects to ' + this.getResponseHeader("Location"));
  } else {
    console.log('request does not redirect');
  }
}
xhr.open('HEAD', 'https://t.co/Ui4Wmesq1j', true);
xhr.send();

Links – many of them mentioning CORS, but few CSP:

Read the rest of this entry »

Posted in Communications Development, Development, HTTP, Internet protocol suite, Software Development, TCP, Web Development | Tagged: , , | Leave a Comment »