在webview android中的google drive / doc viewer中删除弹出选项

时间:2015-08-31 12:57:41

标签: android

删除webview android中的google drive / doc viewer中的弹出选项

我需要在webview中查看pdf,用户无法保存irt以便隐藏所有选项

1 个答案:

答案 0 :(得分:-1)

//initialze WebView
webview = (WebView) findViewById(R.id.fullscree_webview);

//set the javascript enable to your webview
webview.getSettings().setJavaScriptEnabled(true);

//set the WebViewClient
webview.setWebViewClient(new WebViewClient() {

//once the page is loaded get the html element by class or id and through javascript hide it.
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            webview.loadUrl("javascript:(function() { " +
                    "document.getElementsByClassName('ndfHFb-c4YZDc-GSQQnc-LgbsSe ndfHFb-c4YZDc-to915-LgbsSe VIpgJd-TzA9Ye-eEGnhe ndfHFb-c4YZDc-LgbsSe')[0].style.display='none'; })()");
        }
    })