3

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.

3

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.