Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android WebView : Remove pop-out option in google drive/doc viewer

I am loading the pdf documents in WebView through appending the pdf url to google doc api

http://docs.google.com/gview?embedded=true&url=myurl

Pdf is loading just fine but the webpage displays two options - Zoom-in and Pop-Out. Is there any way to disable/hide pop-out option by sending some param? Any help would be appreciated.Thanks in advance!

enter image description here

like image 275
Abhishek V Avatar asked Dec 31 '14 06:12

Abhishek V


1 Answers

You can add this callback and in a result "pop-out" button will be removed.

@Override
    public void onPageFinished(WebView view, String url) {

        super.onPageFinished(view, url);
        mWebView.loadUrl("javascript:(function() { " +
                "document.querySelector('[role=\"toolbar\"]').remove();})()");
    }

Note: If you want to now show this button at all, make your web view visible after applying last javascript code.

like image 179
Karim Karimov Avatar answered Sep 19 '22 17:09

Karim Karimov