XMLHttpRequest to send a GET HTTP request with an username/password XMLHttpRequest to send a GET HTTP request with an username/password google-chrome google-chrome

XMLHttpRequest to send a GET HTTP request with an username/password


You need to add headers to the XHR request manually.

xml.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password))

Demo here: http://jsbin.com/inuhiv/2 (NOte, there is nothing to auth, however look at devtools and see the request has auth header)

enter image description here