Pregunta

I try to access a different domain site that way: http://jsfiddle.net/carolineBda/2uZnP/

I always get (error visible in the console):

XMLHttpRequest cannot load http://www.google.fr. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://fiddle.jshell.net' is therefore not allowed access.

I've configured the httpProvider like that:

app.config(['$httpProvider',function ($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);

Any ideas what I'm missing? Thanks for your help.

¿Fue útil?

Solución

The service you are requesting is not allowing CORS (no Access-Control are sent as part of the response). So the web browser is not allowing it. This is the expected behavior and not an Angular issue.

Also check this

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top