in src/android/InAppBrowser.java [396:419]
private void injectDeferredObject(String source, String jsWrapper) {
if (inAppWebView!=null) {
String scriptToInject;
if (jsWrapper != null) {
org.json.JSONArray jsonEsc = new org.json.JSONArray();
jsonEsc.put(source);
String jsonRepr = jsonEsc.toString();
String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
scriptToInject = String.format(jsWrapper, jsonSourceString);
} else {
scriptToInject = source;
}
final String finalScriptToInject = scriptToInject;
this.cordova.getActivity().runOnUiThread(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
inAppWebView.evaluateJavascript(finalScriptToInject, null);
}
});
} else {
LOG.d(LOG_TAG, "Can't inject code into the system browser");
}
}