There is a demand to make cross domain request to a remote service in chrome extension via ajax.
All works properly while user is authorized on a service before he/she uses the extension. But when an unathorized user makes a request extension fails with 401 error code (unathorized).
My sake is to accomplish browser like appearance. If you aren't authorized on some webpage browser dialog-box appears suggesting you to input your credentials. Since they are correct browser display webpage content.
I've tried to add to extensions HTML layout some invisible element that lies on a service to force browser built-in domain authorization dialog appear, but id doesn't seem to be correct approach.
Long story short, do you know some strategy to force browser built-in authorization from chrome extension or simply via javascript code without redirecting user to some separate service webpage. Or, maybe, this is impossible and why?
Code that makes request is simple:
$.ajax({
url: 'service url that requires authorization',
dataType: 'json',
success: function (info){
//success handler
},
error: function (){
//error handler
}
});
WBR, Vitaliy