Issue
I've set up a basic WebView in Android, and has pointed it to a url on my root domain (eg. https://example.com). I want to connect to a sockjs server at another port, but on the same domain (eg. https://example.com:81).
Now, it works like a charm in the default Android browser - but not in a WebView. The WebView loads my (CORS) Ajax request in Android 4.0, however in fx. Gingerbread and Froyo it doesn't.
Sockjs sets the header: Access-Control-Allow-Origin:https://example.com
Thanks!
UPDATE: I have found out that everything is fine without https...
Solution
Okay, I found out that my CA, Startcom SSL Authority, was not trusted by Android, and since my page was in a WebView, I didn't see the warning message. I inserted this code to make it "trust" my certificate:
mainWebView.setWebViewClient(new WebViewClient() {
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
handler.proceed() ;
}
});
Hope this helps anyone out there who has the same problem.
Answered By - Fredefl
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.