JavaScript redirect URL with Authorization header
问题 I managed to successfully invoke a URL behind a directory in Apache that is protected with Basic Authentication (htpasswd, etc.). The Ajax GET request works normally and returns the protected content: var encoded = Base64.encode(username + ':' + password); $.ajax({ url: "/app/test", type: "GET", beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + encoded); }, success: function() { window.location.href = '/app/test.html'; } }); My original assumption was that once the