Question

I have an application with WebView

I tried to load external data via Ajax (Get) but it failed with no errors, tried JSONP and failed with no errors too.

Now here are more info:

When my External Source is an IP-Based like http: //192.168.0......../path/data Things work fine for both JSON and JSONP

but when the external source is a Domain http:// subdomain.mydomain.com Things doesn't work (it never completes loading)

I even tried to specify the JSONP source as

<script src="http://subdomain.mydomain.com/path/?callback=callbackFunc"></script>

but still this script never completes loading

Please notice that the external URL works normally in web-browser and even on my PC (using the JSONP method).

I believe it's either Cross-Domain policy problem which I don't know how to fix.

or a DNS problem (Which I don't know how to fix too).

or there might be a better way for loading external data inside WebView in android

Was it helpful?

Solution

Ok I found the answer to the problem,

The UserAgent of my Android was being blocked on my server for the specified path,

The IP I was using was a network IP, while the domain was another server . .

now it's fixed..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top