How to prevent Phonegap / Android app_webview from storing cache?

Viewed 684

We have a Phonegap application, and for Android, we came across a problem where many information are being cached, including personal data from the user when he logs in (Social Media response - Name, E-mail, Social media profile) - Which from a security aspect is not good.

To solve this problem, I would like to prevent the application from creating cache files on

[App root]/app_webview/Cache/

I have tried a plugin that consists on the following lines of code:

WebView wv = (WebView) webView.getView();
WebSettings ws = wv.getSettings();
ws.setAppCacheEnabled(false);
ws.setCacheMode(WebSettings.LOAD_NO_CACHE);

But the files are still being created.

I have seen a few recommendations related to add HTTP headers (Pragma and Cache-Control), but it is not clear to me how setting request headers would prevent the application from caching the response.

Besides that, running a plugin with the following code:

WebView wv = (WebView) webView.getView();
wv.clearCache(true);

Seems to delete the files, but I believe we should not let these files be created.

Any ideas?

0 Answers
Related