Android - Copy Option inside webview not working

Viewed 278

I am developing an app which displays webview content, inside webview i have one button to copy the code, when i click that copy button it shows error message like "Sorry, something went wrong, Please try again in a moment"..

Exactly what I need is there s a copy button in the website, and when I'm clicking on it in the browser it works, bur it doesn't work in the WebView, so I think, that something is breaking JavaScript from the executing correctly in the WebView.

Can anyone help me to solve this issue..

Thanks in Advance..

  webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setUseWideViewPort(false);
    webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    webView.getSettings().setAllowFileAccess(true);
    webView.getSettings().setAllowFileAccessFromFileURLs(true);
    webView.getSettings().setAllowContentAccess(true);
    webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
    webView.setLayerType(WebView.LAYER_TYPE_HARDWARE, null);
    webView.getSettings().setMediaPlaybackRequiresUserGesture(false);

    webView.addJavascriptInterface(new WebAppInterface(), "NativeAndroid");


    String ua = webView.getSettings().getUserAgentString();
    webView.getSettings().setUserAgentString(ua.replaceAll("wv", ""));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
    }
    webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
    webView.setWebViewClient(new SSLTolerentWebViewClient());
0 Answers
Related