LetoLetoD
LetoLetoD

Reputation: 51

QT QML WebView Cache

I use WebView (import QtWebView 1.1) in my app for android. Is it really no way to do such simple things like reset cookie or clear cache in WebView? It seems if I need this and may be another simple settings control I must write my app in android native and use android native webview?

edit: My question was mark as duplicate, but I ask about WebView in QT/QML, not native WebView from Android Studio.

Upvotes: 3

Views: 1458

Answers (1)

Muki
Muki

Reputation: 11

On Android, QML WebView (=QtWebView 1.1) cache is stored in [APPROOT]/app_webview. To clear cache just delete that directory. For example like this:

QStringList dataDirs = QStandardPaths::standardLocations(
                                 QStandardPaths::DataLocation);
QDir cacheDir(dataDirs.at(0) + "/../app_webview");
if (cacheDir.exists())
    cacheDir.removeRecursively();

update: I've just tested it and empty cache will be visible for WebView after app restart

Upvotes: 1

Related Questions