https://login:password@test.ru
var request = new XMLHttpRequest();
request.open("POST", "test.ru", false);
request.setRequestHeader("Authorization", "Basic " + btoa(user + ":" + password));
request.loaded = function()
{
window.location.reload(); // обновление страницы
};
request.send();