How to clear the cache in a Titanium WebView?

我与影子孤独终老i 提交于 2019-12-12 01:55:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!