ajax - Access to restricted URI denied" code: "1012 -



ajax - Access to restricted URI denied" code: "1012 -

on domain (localhost:8080) run code access unauthenticating rest serivce on domain b (localhost):

req = new xmlhttprequest(); req.open('get', 'http://localhost/rest/service'); req.send();

this works fine , response across domains have apache on domain b set response header:

header set access-control-allow-origin "http://localhost:8080"

however if turn on authentication rest service , seek run same request:

req.open('get', 'http://admin:admin@localhost/rest/service');

it produces error in firebug:

access restricted uri denied" code: "1012

i'm confused able sucessfully create cross domain ajax calls authenticated service bypassing same origin policy, yet when authentication required on service firefox decides not allow ajax call? how can prepare without using jsonp etc, production server won't able provide php or servlet hosting.

it's easy jquery 1.5+, recommend utilize javascript solution:

$.ajax({ url: 'http://admin:admin@localhost/rest/service', crossdomain:true, // here jsonp callback logic success: function(data){ console.log(data); // info comes remote file } });

ajax firefox

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -