1

I am working on a project which requires opening another Web app in app browser. For that, I used WebView inside Activity and simply loads the Web App URL into it. But it is not rendering the page as it renders in Chrome browser. I have searched for that and updated some WebView setting in Activity but still no luck. Following are the settings: webView.getSettings().setJavaScriptEnabled(true);

    // Other webview options
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    webView.setScrollbarFadingEnabled(false);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setAllowFileAccess(true);
  webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setAppCacheEnabled(true);

Do I need to add more settings apart from that? Any leads will be appreciable.

Profreak
  • 11
  • 6
  • check this question's answer https://stackoverflow.com/questions/7305089/how-to-load-external-webpage-inside-webview – karthik Nov 15 '17 at 06:07
  • mWebView.getSettings().setJavaScriptEnabled(true); should be enough, maybe your WebView has other Visibility state than VISIBLE ? maybe you don't have permission Internet in Manifest? – b2mob Nov 15 '17 at 06:09
  • @b2mob The app has all the permission required, the Web page is getting rendered but some of the parts of it is not rendering correctly. – Profreak Nov 15 '17 at 06:18
  • @Profreak can you post the url? Maybe it's mobile page version has some errors? – b2mob Nov 15 '17 at 06:20
  • 1
    There is no error in page as it is rendering correctly in mobile chrome browser. – Profreak Nov 15 '17 at 06:22
  • @Profreak are you fix it ? i am also facing this problem – Sheharyar Ejaz Feb 01 '20 at 13:43

1 Answers1

0

Try using viewport properties.

You can enable wide viewport mode with setUseWideViewPort().

You can define properties of the viewport for your web page, such as the width and initial zoom level, using the <meta name="viewport" ...> tag in your document <head>.

Check this tutorial for additional insights.

Teyam
  • 6,770
  • 3
  • 13
  • 22