0

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.

Community
  • 1
  • 1
ThinkFloyd
  • 4,981
  • 6
  • 36
  • 56
  • create a proxy file on your localhost?? For example in php can be a simple one line `echo file_get_contents(url)` – charlietfl Jan 02 '13 at 07:01
  • Can you enable cross domain access in your dev environment? If you can try this answer http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain and http://enable-cors.org/ – Arun P Johny Jan 02 '13 at 07:01
  • What server are you running on your local development environment? I had similar issues until I started using Sencha's CMD line to start a little server for my project. http://www.ladysign-apps.com/developer/environment/use-the-sencha-cmd-webserver/ – antman Dec 02 '13 at 23:40

1 Answers1

0

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: *

Community
  • 1
  • 1
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
  • In case it is not working for you, please kill all chrome instances and start it with this flag. BTW here is my shortcut's target `/usr/bin/chromium-browser %U --disable-web-security` – ThinkFloyd Jan 16 '13 at 13:42