CORS and phonegap apps

后端 未结 4 1594
走了就别回头了
走了就别回头了 2020-11-28 11:10

Do phonegap applications require any CORS changes (like setting Access-Control-Allow-Origin:*) to work? I have a restful API hosted on Heroku and was wondering whether I nee

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 11:25

    PhoneGap you can just XHR directly to remote servers and it should "just work". Cross-domain policy does not apply to PhoneGap (for a variety of reasons, basically because your app is essentially running off the file:// URI on-device).

    Please be aware that you will have to set up a whitelist for your apps to access these external domains. Please check this link:

    http://docs.phonegap.com/en/1.8.0rc1/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide

提交回复
热议问题