Ionic筆記(1)android使用web service

在瀏覽器(browser)上測試,會遇到CORS問題,


在chrome可以用plugin,做為測試時的解決方案,如果正式情況下還是要請Server side修改,在android上要安裝cordova plugin whitelist,並確認在Ionic專案中的config.xml中有加入<access origin="*"/>,未來在正式版本中可改為web service的路徑,增加安全性

cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git

Cordova Whitelist · Ionic.io Documentation - http://goo.gl/ITKAmC
apache/cordova-plugin-whitelist - https://goo.gl/HeAHxq

留言