简体   繁体   中英

Cross Domain API call on mobile

I am getting following error on mobile while trying to make cross domain call

XMLHttpRequest cannot load http://domain1.com . Origin http://domain2.com is not allowed by Access-Control-Allow-Origin.

Is there any workaround for the same?

try using jsonp, that's the only way around http://json-p.org/ , http://blog.edwards-research.com/2012/10/cross-domain-ajax-a-simple-workaround/ , or make sure that on server side cross domain policy file is present and changed accordingly http://hub.tutsplus.com/tutorials/quick-tip-a-guide-to-cross-domain-policy-files--active-3832 quite simply just allow access from all and test.

However the best way would be is to use jsonp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM