- I am developing a Google chrome plugin.
- under the options page I am running a AJAX request to the server that requires PASSWORD
- I just want to catch the error if Password was incorrect, but browser is giving a popup window.
Can I disable it and how?
Can I disable it and how?
The problem is you’re not Base64-encoding the username (i.e., authentication token) and (dummy) password you’re sending (which is a requirement of the HTTP Basic authentication scheme). Here’s roughly what your code ought to look like:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://onsip.highrisehq.com/account.xml');
xhr.setRequestHeader('Authorization', 'Basic ' + btoa(token + ':'));
xhr.onreadystatechange = function() { console.log(xhr.responseText); };
xhr.send();
(I swapped in 'onsip'
as the subdomain for you, but you still need to replace token
with your authentication token.)
I know two ways one can do this in Firefox XUL code (but not web code), one of which I know doesn't apply to Google chrome, and a quick test seems to indicate the other doesn't either.
Three options occur to me.