How to prevent app_webview from caching Phonegap / Android?

We have a Phonegap application, and for Android we encounter a problem when a lot of information is cached, including personal data from the user when they log in (the answer is "Social Media" - name, email, profile on social networks) - Which of the security aspects not very good.

To solve this problem, I want the application not to create cache files on

[Application Root] / app_webview / Cache /

I tried a plugin that consists of 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 saw several recommendations related to adding HTTP headers (Pragma and Cache-Control), but it is not clear to me how to configure request headers so that the application does not cache the response.

Alternatively, run the plugin with the following code:

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

, , , .

?

+4

Source: https://habr.com/ru/post/1677281/


All Articles