PhoneGap / Cordoba, Ripple Emulator, CORS & JSONP

Trying to use Ripple emulator to test PhoneGap application. We make requests to the server and get:

ERROR:

cordova :: XMLHttpRequest :: setRequestHeader does not work with JSONP.

  • a) CORS is enabled on the server and client
  • b) Queries work in the browser
  • c) Requests work on a mobile device
  • d) I have enabled "Allow access to file URLs" in the settings of the Ripple Chrome extension.
  • e) I ran chrome with flags:

- disable-web-security --allow-file-access-from-files

Does Ripple Emulator CORS support httprequest or just jsonp?

If it supports calling from more than JSONP, I could use some help with implementation.

Thanks!

+6
source share
2 answers

Ripple Emulator supports CORS httprequest support, but you need to host your html page as a website on your computer and access it using http://localhost/yourvirtualdir/yourfile.html .

+8
source

Instead of setting up a virtual directory or IIS entry, use the PHP built-in development web server. This works in Windows and Linux environments.

http://php.net/manual/en/features.commandline.webserver.php

 $ cd ~/public_html $ php -S localhost:8000 

Now you can open a browser and go to http://localhost:8000 , and your site \ application will be served. You can then enable Ripple at this URL.

+1
source

All Articles