16

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 same webview page with the same URL in another screen then I am unable to do that because if I use the same webview object in different screens then also it takes time to load the URL.

How do I make my webview to load a URL instantly?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
  • WebView trades speed for flexibility. If you're needing to work with web content faster, please consider using a browser intent rather than embedding a WebView in your app. You may be able to see some improvement by disabling the liberal cacheing in WebView as seen in this solution: http://stackoverflow.com/questions/3652583/enhance-webview-performance-should-be-the-same-performance-as-native-web-browser/4799448#4799448 – Brian Jun 09 '11 at 16:05
  • I had done two things 1) call load methods on web views when user launches the app. 2) If the webview is not ready and user clicked the tab for it, then show a loader progress dialog – Piyush-Ask Any Difference Jun 13 '13 at 01:06
  • may be , this link help you. http://stackoverflow.com/questions/7422427/android-webview-slow – Azahar Jan 24 '15 at 17:01

4 Answers4

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.

Stephanvs
  • 723
  • 7
  • 19
0

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)); 
dharmendra
  • 7,835
  • 5
  • 38
  • 71
0

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);
kleopatra
  • 51,061
  • 28
  • 99
  • 211