I am facing an issue while loading an HTML file from the SD card to a webview. The problem is that the CSS, images, and videos are not loading properly in the webview.
Compatible with Android 4.4 KitKat and Chrome version
Not compatible with versions below 4.4 KitKat
I have tried both methods of directly passing the URL in loadUrl and using loadDatawithBaseurl, but none of them seem to work correctly for me.
mWebview=(WebView)findViewById(R.id.webview);
mWebview.getSettings().setJavaScriptEnabled(true);
mWebview.setWebChromeClient(new WebChromeClient());
mWebview.setWebViewClient(new WebViewClient());
mWebview.loadUrl("file:///storage/emulated/0/13119/news66.html");
I also attempted the following:
data=getHTMLDataBuffer("file:///storage/emulated/0/13119/news66.html");
mWebview.loadDataWithBaseURL("file://"+Environment.getExternalStorageDirectory().getAbsolutePath().toString()+"/13119/",data,"text/html","UTF-8", null);
Chrome ScreenShot
Webview ScreenShot