WebStorage
public
class
WebStorage
extends Object
java.lang.Object | |
↳ | android.webkit.WebStorage |
This class is used to manage the JavaScript storage APIs provided by the
WebView
. It manages the Web SQL Database API and the HTML5 Web
Storage API.
The Web SQL Database API provides storage which is private to a given origin.
Use of the Web SQL Database can be attributed to an origin. It is also
possible to set per-origin quotas.
Summary
Nested classes | |
---|---|
class |
WebStorage.Origin
This class encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs. |
interface |
WebStorage.QuotaUpdater
This interface was deprecated in API level 19. This class is obsolete and no longer used. |
Public methods | |
---|---|
void
|
deleteAllData()
Clears all storage currently being used by the JavaScript storage APIs. |
void
|
deleteOrigin(String origin)
Clears the storage currently being used by the Web SQL Database APIs by the given origin. |
static
WebStorage
|
getInstance()
Gets the singleton instance of this class. |
void
|
getOrigins(ValueCallback<Map<K, V>> callback)
Gets the origins currently using the Web SQL Database APIs. |
void
|
getQuotaForOrigin(String origin, ValueCallback<Long> callback)
Gets the storage quota for the Web SQL Database API for the given origin. |
void
|
getUsageForOrigin(String origin, ValueCallback<Long> callback)
Gets the amount of storage currently being used by the Web SQL Database APIs by the given origin. |
void
|
setQuotaForOrigin(String origin, long quota)
This method was deprecated in API level 18. Controlling quota per-origin will not be supported in future. |
Inherited methods | |
---|---|
Public methods
deleteAllData
public void deleteAllData ()
Clears all storage currently being used by the JavaScript storage APIs. This includes Web SQL Database and the HTML5 Web Storage APIs.
deleteOrigin
public void deleteOrigin (String origin)
Clears the storage currently being used by the Web SQL Database APIs by the given origin. The origin is specified using its string representation.
Parameters | |
---|---|
origin |
String |
getInstance
public static WebStorage getInstance ()
Gets the singleton instance of this class.
Returns | |
---|---|
WebStorage |
the singleton WebStorage instance |
getOrigins
public void getOrigins (ValueCallback<Map<K, V>> callback)
Gets the origins currently using the Web SQL Database APIs. This method
operates asynchronously, with the result being provided via a
ValueCallback
. The origins are provided as
a map, of type Map<String, WebStorage.Origin>
, from the string
representation of the origin to a WebStorage.Origin
object.
Parameters | |
---|---|
callback |
ValueCallback |
getQuotaForOrigin
public void getQuotaForOrigin (String origin, ValueCallback<Long> callback)
Gets the storage quota for the Web SQL Database API for the given origin.
The quota is given in bytes and the origin is specified using its string
representation. This method operates asynchronously, with the result
being provided via a ValueCallback
.
Parameters | |
---|---|
origin |
String |
callback |
ValueCallback |
getUsageForOrigin
public void getUsageForOrigin (String origin, ValueCallback<Long> callback)
Gets the amount of storage currently being used by the Web SQL Database
APIs by the given origin. The amount is given in bytes and the origin
is specified using its string representation.
This method operates asynchronously, with the result being provided via
a ValueCallback
.
Parameters | |
---|---|
origin |
String |
callback |
ValueCallback |
setQuotaForOrigin
public void setQuotaForOrigin (String origin, long quota)
This method was deprecated
in API level 18.
Controlling quota per-origin will not be supported in future.
Sets the storage quota for the Web SQL Database API for the given origin. The quota is specified in bytes and the origin is specified using its string representation.
Parameters | |
---|---|
origin |
String |
quota |
long |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
TMZ Celebrity News – Breaking Stories, Videos & Gossip
Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.
Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.
🎥 Watch TMZ Live
TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.
- Exclusive TMZ interviews and court updates
- Viral celebrity videos and candid photos
- Trending gossip and entertainment news