CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+
This commit is contained in:
parent
0ce0eed585
commit
e807bc3dc0
@ -253,11 +253,16 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
scriptToInject = source;
|
||||
}
|
||||
final String finalScriptToInject = scriptToInject;
|
||||
// This action will have the side-effect of blurring the currently focused element
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
// This action will have the side-effect of blurring the currently focused element
|
||||
inAppWebView.loadUrl("javascript:" + finalScriptToInject);
|
||||
} else {
|
||||
inAppWebView.evaluateJavascript(finalScriptToInject, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user