Issue
I want to Android webview cache my website. But I don't want to cache a js file that maybe update every 5 minutes. Is it possible to ignore this file from android webview caching?
Solution
No, one can only set caching completely to false:
mWebView.getSettings().setAppCacheEnabled(false);
mWebView.clearCache(true);
You could ignore caching to that specific js file by using a timestamp as a request parameter when loading that file.
For example, you could include your js file like this:
<script src="js/my_script.js?ver=1626534617"></script>
(where 1626534617 is the current Unix timestamp)
Using a parameter like that, will result in always requesting for the file from the server, hence bypassing the webview cache.
Answered By - Rusu Dinu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.