问题
This is the code for my webview in Titanium (3.4.0):
var webView = Ti.UI.createWebView({
url: pUrl,
autoDetect: [ Ti.UI.AUTODETECT_NONE ]
});
I just need to clear the cache of this var webView. I've googled and found a bunch of similar questions but solutions don't actually clear the cache since (as far as I know), there's no built-in function or method for Titanium's WebView to clear it's cache. The reason why I need to clear the cache is I need to clear the username and password of a user's account. Just for additional information, I'm using this webView in Android.
回答1:
I am not quite sure whether you can clear the cache in titanium easily but maybe you should disable it completely. Have a look at setCacheMode(cacheMode)
in the documentation. This method allows you to set the caching mode to one of several predefined modes which are described in the documentation. One of them is Titanium.UI.Android.WEBVIEW_LOAD_NO_CACHE
which is preventing the webView from caching. Please note that this property only works on Android!
来源:https://stackoverflow.com/questions/27029435/how-to-clear-the-cache-in-a-titanium-webview