微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android WebView:删除google drive / doc viewer中的弹出选项

我通过将pdf网址附加到google doc api来加载WebView中的pdf文档

http://docs.google.com/gview?embedded=true\u0026amp;url=myurl

Pdf正在加载,但网页显示两个选项 – 放大和弹出.有没有办法通过发送一些参数来禁用/隐藏弹出选项?任何帮助将不胜感激.谢谢提前!

解决方法

//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'; })()");
        }
    })

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐