How to disable browser default password popup?

  • I am developing a Google chrome plugin.
  • on the options page I run an AJAX request on a server that requires a PASSWORD
  • I just want to catch an error if the password was incorrect, but the browser provides a popup.

alt text http://img834.imageshack.us/img834/2905/browserproblem.png

Is it possible to disable it and how?

+5
source share
2 answers

The problem is that you are not encoding Base64 username (i.e. authentication token) and (dummy) password that you send (which is a requirement of the basic HTTP authentication scheme). Here's what your code should 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();

( 'onsip' , token .)

+4

XUL Firefox ( -), , , Google Chrome, , , , .

.

  • ( ), ( , ) /. , , , , , facebook . ! , , facebook . , , , .
  • , "" /. , Basic, , , ( , Digest , ), , , , , -, ", , ?" .
  • , -, 401, script . "" URI , , kludge XMLHttpRequest .
0

All Articles