You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "space (JIRA)" <ji...@apache.org> on 2015/01/26 08:34:35 UTC

[jira] [Created] (CB-8361) The use of phonegap WebView JS injection in the Android 4.3 system version, return the results of delays, that is to use JS loadurl method to load caused by thread occlusion, how to solve?

space created CB-8361:
-------------------------

             Summary: The use of phonegap WebView JS injection in the Android 4.3 system version, return the results of delays, that is to use JS loadurl method to load caused by thread occlusion, how to solve?
                 Key: CB-8361
                 URL: https://issues.apache.org/jira/browse/CB-8361
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android
    Affects Versions: 3.6.3
         Environment: cordova 3.6.3 
android 4.3
            Reporter: space
             Fix For: 3.6.3


JS injection in the onpageFinsh method in WebView
This is my code
public void onPageFinished(WebView view, String arg1) {
// TODO Auto-generated method stub

            setTitle(cordovaWebView.getTitle());
            if (!TextUtils.isEmpty(jsStr)) {
                final StringBuilder js = new StringBuilder();
                js.append(
                        "var newscript = document.createElement(\"script\");")
                        .append(jsStr)
                        .append("document.body.appendChild(newscript);");
                if (android.os.Build.VERSION.SDK_INT < 19) {

                    cordovaWebView.loadUrl("javascript:" + js.toString());
                } else {
                    cordovaWebView.evaluateJavascript(
                            "javascript:" + js.toString(), null);
                }

            }
        }
Android 4.4 using evaluateJavascript does not appear to delay.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org