Android 4.0.1 breaks WebView HTML 5 local storage?

JavascriptWeb DevelopmentFront End Scripts

To solve this problem, follow the below-given steps −

For android versions less than 4.4, loading data into a webview with a file scheme as a directory like this won’t work.

browser.loadDataWithBaseUrl("file:///android_asset/", html, "text/html", "UTF-8", null);

Add a filename and it works on older Android versions −

browser.loadDataWithBaseUrl("file:///android_asset/new.html", htmlContent, "text/html", "UTF-8", null);

You can use the following too, in case your URL is http://www.demo.com −

browser.loadDataWithBaseURL("http://www.demo.com", htmlContent, "text/html", "utf-8", null);
raja
Published on 06-Apr-2018 07:37:51
Advertisements