1

WebView is loading data from url.

wvBrowser.loadUrl(MainActivity.URL_ABOUT);

On WebViewClient's onPageStarted method I am trying to use javascript:

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        String javascript = "javascript: "
                + "document.getElementById('logo').setAttribute(\"style\",\"pointer-events: none ;\");";
        view.loadUrl(javascript);
    }

Result: element is still clickable.

How to make only one element unclickable?

Joe Rakhimov
  • 4,713
  • 9
  • 51
  • 109

1 Answers1

1
webView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
       return true; //True if the listener has consumed the event, false otherwise. 
    }  
});

It will disable the webview touch event

webView.setFocusableInTouchMode(false);
webView.setFocusable(false);

It will make the links non-focusable.

Check this for more customization using javascript in android

https://stackoverflow.com/a/4075955/3020568

Community
  • 1
  • 1
Deniz
  • 12,332
  • 10
  • 44
  • 62