Question

I have one responsive website. I load it in my android application using Webview. In some devise like samsung s2, micromax tablet it load with proper manner with website design. but In some devise like sonyxperia and emulltor I load only text of website not loaded website design. my website is responsive. I used below code to load website

 webView=(WebView)findViewById(R.id.webView);
 webView.getSettings().setJavaScriptEnabled(true);
 webView.loadUrl("http://xyz responsive url");

If any one have solution to load mobile app on android devise then please comment here.

Was it helpful?

Solution

Depending on the Android version you're using, WebView will not be able to render you website as you expect because it is not a full browser, but it has only some HTML rendering capabilities.

Starting on Android 4.4 (KitKat), WebView uses the same rendering engine as Chrome, so the render of your website using WebView should be much more consistent.

Also, WebView in Android < 4.4 won't have support for all JavaScript you may want to run in your webpage.

If you're trying to render an HTML5 webpage, try your WebView component using HTML5test and see if it has support for all the features you want in your webpage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top