Android 9 WebView shows nothing

0

I have an app opening remote url in WebView. The problem is Android 9 shows nothing while Android 7 does work as intended.

Initialization like this:

imageGalleryWebView.clearCache(false);
imageGalleryWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
imageGalleryWebView.setBackgroundColor(0x00000000);
imageGalleryWebView.getSettings().setJavaScriptEnabled(true);
imageGalleryWebView.getSettings().setUseWideViewPort(true);
imageGalleryWebView.setInitialScale(1);
imageGalleryWebView.getSettings().setLoadWithOverviewMode(true);
imageGalleryWebView.getSettings().setDomStorageEnabled(true);
imageGalleryWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
imageGalleryWebView.loadUrl(getUrl());

The page loaded is out of my control. The page contains a few javascripts (some loaded externally so I can't even look at them). New Android just shows blank screen.

On logcat I get these lines:

I/chromium: [INFO:CONSOLE(1)] "Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.", source: https://my.website/HTMLTemplate.aspx?TemplateID=1

The above line probably mentions incorrect semicolon in HTML:

<meta content="user-scalable=0;" name="viewport" />

I don't sure if that should prevent loading and presenting the whole page.

Other line in logcat:

I/chromium: [INFO:CONSOLE(24)] "Mixed Content: The page at 'https://my.website/HTMLTemplate.aspx?TemplateID=1' was loaded over HTTPS, but requested an insecure image 'http://some.other.site/thumb'. This content should also be served over HTTPS.", source: https://my.website/HTMLTemplate.aspx?TemplateID=1 (24)

That seems like a warning, but I have in Manifest android:usesCleartextTraffic="true" so this should not prevent too.

Anyone knows about some changes in recent Android versions's WebView that I can fix? (I can't change the url's content atm)

Thank you

javascript
android
html
webview
asked on Stack Overflow Oct 8, 2019 by Shmuel • edited Oct 8, 2019 by Shmuel

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0