How to use json proxy to access remote services during development

為{幸葍}努か 提交于 2019-12-02 16:33:22

问题


This is my doubt after going through

How to send headers while using jsonp proxy?

and

How Ajax call is working in mobile app (PhoneGap), but not in PC browser?

As per this we can use json proxy instead of jsonp in mobile but not in desktop browser. This sounds good but my problem is I am using my desktop as develop environment and browser is quickest way to test and debug whatever I am doing but if I use json proxy this won't work because of cross domain issues. Please suggest ways such that I can easily develop and debug application on my desktop itself.

My workstation has Ubuntu OS and I use Chrome browser for testing.


回答1:


I think for the development purpose you can disable cross domain policy in your browser as given here.

  1. create a short cut for the chrome browser in you desktop
  2. add the following flag to the short cut --disable-web-security

Or

You can setup your dev server to allow cross domain requests as given here or [here]

1. Add the following header to your response Access-Control-Allow-Origin: *



来源:https://stackoverflow.com/questions/14118053/how-to-use-json-proxy-to-access-remote-services-during-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!