Skip to content Skip to sidebar Skip to footer

How To Improve Webview Load Time

I have a URL which I can load in webview. If I open the webview through browser it takes less time, but if I load the URL in webview it takes more time. Also if I have to reuse the

Solution 1:

You could use the YSlow or Google PageLoad plugins for your browser, to get specific tips on how to improve page load and speed up your page.


Solution 2:

You could try a different cache mode: http://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode%28int%29

or, if the page doesn't change, just use loadDataWithBaseURL: http://developer.android.com/reference/android/webkit/WebView.html#loadDataWithBaseURL%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29


Solution 3:

By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored.

here i paste small part of code of zirco-browser

settings.setJavaScriptEnabled(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_JAVASCRIPT, true));
            settings.setLoadsImagesAutomatically(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_IMAGES, true));
            settings.setUseWideViewPort(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_USE_WIDE_VIEWPORT, true));
            settings.setLoadWithOverviewMode(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_LOAD_WITH_OVERVIEW, false));
            settings.setSaveFormData(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_FORM_DATA, true));
            settings.setSavePassword(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_PASSWORDS, true));
            settings.setDefaultZoom(ZoomDensity.valueOf(Controller.getInstance().getPreferences().getString(Constants.PREFERENCES_DEFAULT_ZOOM_LEVEL, ZoomDensity.MEDIUM.toString())));             
            settings.setUserAgentString(Controller.getInstance().getPreferences().getString(Constants.PREFERENCES_BROWSER_USER_AGENT, Constants.USER_AGENT_DEFAULT)); 

Solution 4:

set render priority high for your web view can solve problem up to some extent its some thing like this

webview.getSettings().setRenderPriority(RenderPriority.HIGH);

Post a Comment for "How To Improve Webview Load Time"