0
votes

I have a local HTML file (e.g. file:///xxx.html) containing AJAX code to read and process contents of pages on remote hosts (that are not my own). On desktop, I do this by running a local web server that returns remote data (I use Nginx with proxy_pass on specific url patterns). For example, if I want to get data from http://example.com/, I use JQuery's ajax with http://localhost:9000/http://example.com/ as the URL.

How can I do this on (non-rooted) Android? Is there an Android web server that supports proxy_pass on specific url patterns? Or is there an Android app/browser that allows cross-domain AJAX requests from local HTML files? Or any other solutions?

1

1 Answers

0
votes

By default from Any Android Browser starting from Android 2.1, it supports CORS (Cross-Origin Resource Sharing) feature. Check: http://caniuse.com/cors

In addition, The REST service also need to configure to allow cors from Server Side as well. For enabling at Server side set an attribute in Response:

Access-Control-Allow-Origin: *

For more refer: http://enable-cors.org/server.html