WebStorageCompat
class WebStorageCompat
Compatibility class for android.webkit.WebStorage that introduces new methods to completely clear data.
WebStorage is tied to WebView Profile instances. If your app uses multiple profiles, then you should ensure that you clear data for all relevant profiles.
A android.webkit.WebStorage instance can be obtained from getInstance, or from getWebStorage if your app is using multiple WebView profiles.
Summary
Public functions |
|
|---|---|
java-static Unit |
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Delete all data stored by websites in the given WebStorage instance. |
java-static Unit |
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Delete all data stored by websites in the given WebStorage instance. |
java-static String |
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Delete data stored by web storage APIs for the specified domain in the given WebStorage instance. |
java-static String |
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Delete data stored by web storage APIs for the specified domain in the given WebStorage instance. |
Public functions
deleteBrowsingData
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun deleteBrowsingData(instance: WebStorage, doneCallback: Runnable): Unit
Delete all data stored by websites in the given WebStorage instance.
This method functions as deleteBrowsingData, but invokes the doneCallback on the UI thread.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
deleteBrowsingData |
deleteBrowsingData
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun deleteBrowsingData(
instance: WebStorage,
executor: Executor,
doneCallback: Runnable
): Unit
Delete all data stored by websites in the given WebStorage instance. This includes network cache, cookies, and any JavaScript-readable storage.
This method will delete all data that was stored before being invoked. Deletion is not an atomic operation, so it may also delete data that is stored during deletion, but this is not guaranteed.
| Parameters | |
|---|---|
instance: WebStorage |
WebStorage instance to delete all data in. |
executor: Executor |
Executor to run the |
doneCallback: Runnable |
callback that will be invoked when deletion is complete. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
deleteBrowsingDataForSite
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun deleteBrowsingDataForSite(
instance: WebStorage,
site: String,
doneCallback: Runnable
): String
Delete data stored by web storage APIs for the specified domain in the given WebStorage instance.
This method functions as deleteBrowsingDataForSite, but invokes the doneCallback on the UI thread.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
deleteBrowsingDataForSite |
deleteBrowsingDataForSite
@RequiresFeature(name = WebViewFeature.DELETE_BROWSING_DATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun deleteBrowsingDataForSite(
instance: WebStorage,
site: String,
executor: Executor,
doneCallback: Runnable
): String
Delete data stored by web storage APIs for the specified domain in the given WebStorage instance. This includes network cache, cookies, and any JavaScript-readable storage.
For partitioned storage, this method will remove all data owned by the site, as well as all storage for content embedded in the specified site, e.g. iframed content.
This method deletes storage for the site part of the input argument. This means that if the input argument contains a subdomain (for example www.example.com), then this method will delete everything belonging to example.com.
This method will delete all data that was stored before being invoked. Deletion is not an atomic operation, so it may also delete data that is stored during deletion, but this is not guaranteed.
| Parameters | |
|---|---|
instance: WebStorage |
WebStorage instance to delete all data in. |
site: String |
The site to delete for. This can be a domain name, or a full URL. |
executor: Executor |
Executor to run the |
doneCallback: Runnable |
callback that will be invoked when deletion is complete. |
| Returns | |
|---|---|
String |
The domain that was used for deletion. This will be the top-level domain part of the |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if unable to parse the |
java.lang.UnsupportedOperationException |
if the |