QUESTION:
What do I have to do to make webView.loadUrl(javaScript) work in API 18 or lower (in comparison to API 19 or higher)?
DESCRIPTION OF PROBLEM:
I am using WebView to make a chat.
- First I load the HTML like so: webView.loadUrl(url);
- Then I use loadUrl again to send in the chat message like so: webView.loadUrl(javaScript);
This works perfectly fine in API >=19 but does not work in API <=18.
Chat messages do still get received from other devices but the other devices do not get a single message from the device with API 18 or lower. The exact same code is used.
I've searched a lot and will continue to search. If you have the answer, any idea that I could test or could redirect me to relevant information please do share. Thank you in advance.
EDIT:
The JavaScript tag in the string is set to lower case (with the same problem): webView.loadUrl("javascript:" + javaScriptFunction);
`WebSettings settings = wv.getSettings();`
`settings.setJavaScriptEnabled(true);`
`JavaBridgeToJS bridgeToJS = new JavaBridgeToJS();`
`wv.addJavascriptInterface(bridgeToJS, "javaCallback");`
`wv.loadUrl("javascript: "var result=foo(); window.javaCallback.result(result)");`
while it's working just fine on API > 18, the callback is not called on 18 :( and there is no line break. – ThinkDeep May 31 '16 at 07:29