Skip to content

Instantly share code, notes, and snippets.

@akoul889
Last active February 2, 2017 07:08
Show Gist options
  • Save akoul889/5b31aa6c982724c139c67d07419a4ac9 to your computer and use it in GitHub Desktop.
Save akoul889/5b31aa6c982724c139c67d07419a4ac9 to your computer and use it in GitHub Desktop.

We use This HTML Data

<html><style>body {margin: 0;} iframe {box-shadow: none !important;}</style><body><iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fashfaq.kodinhi%2Fvideos%2Fvb.100002322468799%2F1202883703132367%2F%3Ftype%3D3&show_text=0&width=560" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe></body></html> 

and load it in a web view

These are the settings for the web view

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportZoom(false);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

These settings are being used to log and debug the issue

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    Uri uriClicked = Uri.parse(url);
                    return true;
                }
                @Override
                public void onLoadResource(WebView view, String url) {
                    super.onLoadResource(view, url);
                }
            });
webView.setWebChromeClient(new WebChromeClient() {
                public boolean onConsoleMessage(ConsoleMessage cm) {
                    Timber.d("Console - "+ cm.message() + " -- From line "
                            + cm.lineNumber() + " of "
                            + cm.sourceId() );
                    return true;
                }
            });

Then we load the Html content using this

webView.loadDataWithBaseURL("https://www.facebook.com/", htmlData, "text/html; " +
                        "charset=UTF-8", "UTF-8", null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment