PhoneGap/Cordova, Ripple Emulator, CORS & JSONP
Asked Answered
V

2

6

Attempting to use the Ripple Emulator to test a PhoneGap application. We're making requests to the server and receiving:

ERROR:

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

  • a) CORS is enabled on the server and the client
  • b) The requests work in the browser
  • c) The requests work on the mobile device
  • d) I enabled the "Allow access to file URLs" in the settings for the Ripple Chrome Extension.
  • e) I launched chrome with the flags:

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

Does Ripple Emulator support CORS httprequest or only jsonp?

If it supports a call from more than just JSONP then I could use some assistance on implementation.

Thank you!

Verda answered 25/2, 2013 at 21:42 Comment(0)
H
8

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

Hiller answered 25/2, 2013 at 23:38 Comment(1)
Thank's @Whizkid747 - you are right. I set up a virtual host and accessed it via that local virtual host and it now makes the request.Verda
W
1

Instead of setting up a virtual directory or IIS entry, use PHP's 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 your browser and navigate to http://localhost:8000 and your site\app will be served up. Then you can enable Ripple on that URL.

Willodeanwilloughby answered 5/2, 2015 at 3:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.