Hello
I am still trying to call an API using angular's $http, but so far I've
been unsuccessful ( in IE, it works fine in Chrome and FF )
This is my code
* $http({*
* url: 'path-to-my-api/myapi',*
* method: 'GET',*
* withCredentials: true,*
* dataType: 'json',*
* headers: {*
* 'Access-Control-Allow-Origin': '*',*
* 'Access-Control-Allow-Credentials':true,*
* //'Access-Control-Allow-Headers':'X-Requested-With',*
* 'Access-Control-Allow-Methods': ['GET', 'OPTIONS']*
* }*
* }).then( function( result ){*
* console.log( 'success');*
* }, function( error ){*
* console.log( error );*
* });*
On top of the headers, I got the following inside config
*myApp.config(['$httpProvider', function($httpProvider) {*
* $httpProvider.defaults.useXDomain = true;*
* delete $httpProvider.defaults.headers.common['X-Requested-With'];*
* }*
*]);*
So, why is that IE still shows me an error ( a 403 Forbidden to be more
precise ).
What is the official angular way to make api calls in IE?
PS: I've tested my code in several IE versions, including the latest 11, 10
and 9, but it still doesnt work
The errors ( or warnings ) that I get are the following:
*XMLHttpRequest for https://path-to-api/myapi <https://path-to-api/myapi>
required Cross Origin Resource Sharing (CORS).*
*SEC7119: XMLHttpRequest for https://path-to-api/myapi
<https://path-to-api/myapi> required CORS preflight.*
Thanks
2014/1/22 James Brewer <[email protected]>
> This looks promising:
> http://samuellam.wordpress.com/2013/08/03/ie-89-cors-support-in-angular-js/
>
>
> On Wed, Jan 22, 2014 at 4:53 PM, Jake K. <[email protected]> wrote:
>
>>
>> Hello,
>>
>> I have a bunch of restful methods which I use in my angularjs app.
>>
>> They work fine in most browsers, except for IE.
>>
>> I get the following warning when I try to start a session, which requires
>> a call to a restful method ( I use $http )
>>
>> *XMLHttpRequest for https://path-to-api/myApi <https://path-to-api/myApi>
>> required CORS preflight*
>>
>> I am not exactly where the error is coming from, so I am not sure how to
>> put a specific question.
>>
>> So, how do I solve this issue?
>>
>> Thanks
>>
>> PS: I also get other similar errors in IE, e.g. *XMLHttpRequest
>> for https://path-to-api/myApi <https://path-to-api/myApi> required Cross
>> Origin Resource Sharing (CORS).*
>> It seems like the error has to do with CORS, but I am not sure.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>>
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/MC_G6gSqH9c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
JAKE KWON +1 (604) 655 3109
email: [email protected]
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.