Using WebView.loadUrl("javascript:...") works differently when targetting KitKat or newer.
After KitKat, calling loadUrl() will evaluate the URL and completely replace the contents of the current page.
To avoid losing JavaScript variable bindings, we should use WebView.evaluateJavascript() (added in KitKat).
Using
WebView.loadUrl("javascript:...")
works differently when targetting KitKat or newer. After KitKat, callingloadUrl()
will evaluate the URL and completely replace the contents of the current page. To avoid losing JavaScript variable bindings, we should useWebView.evaluateJavascript()
(added in KitKat).More Info: https://commonsware.com/blog/2013/10/31/quick-musings-android-4p4.html