Reputation: 436
I am using WebView to load ASP.Net MVC website but loading page is very slow because of loading many.js files
But when I load page in browser e.g. Google Chrome then page loading almost 8 times faster because browser cache the resource files,
I think page is loading slower in WebView because it does not load files from cache. If I do not load resource files (js, css) then web view loading is faster.
My question is how we can make WebView to cache resource files (js, css etc) until they are changed on server as web browser do?
Upvotes: 6
Views: 2939
Reputation:
You can use the WebView cache to enable caching in WebView.
In the properties of the WebView add the following line:
webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
Upvotes: 4