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:





