0

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

2
  • Two things to check. First, do you have INTERNET permission? Second, do you enable Javascript in Webview? Commented May 27, 2012 at 0:24
  • 1
    @xandy yes I mentioned in my question that when the external source is IP, things work normally but when it's a domain name it doesn't . . Commented May 27, 2012 at 0:29

1 Answer 1

0

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..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.