Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/webkit/WebStorage#nestedclasses) \| [Methods](https://developer.android.com/reference/android/webkit/WebStorage#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/webkit/WebStorage#inhmethods)

# WebStorage

*** ** * ** ***

` public class WebStorage `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.webkit.WebStorage |

<br />

*** ** * ** ***

This class is used to manage the JavaScript storage APIs provided by the `https://developer.android.com/reference/android/webkit/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` | `https://developer.android.com/reference/android/webkit/WebStorage.Origin` This class encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs. |
| ` interface` | `https://developer.android.com/reference/android/webkit/WebStorage.QuotaUpdater` *This interface was deprecated in API level 19. This class is obsolete and no longer used.* |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#deleteAllData()() ` Clears all storage currently being used by the JavaScript storage APIs. |
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#deleteOrigin(java.lang.String)(https://developer.android.com/reference/java/lang/String origin) ` Clears the storage currently being used by the Web SQL Database APIs by the given origin. |
| ` static https://developer.android.com/reference/android/webkit/WebStorage` | ` https://developer.android.com/reference/android/webkit/WebStorage#getInstance()() ` Gets the singleton instance of this class. |
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#getOrigins(android.webkit.ValueCallback<java.util.Map>)(https://developer.android.com/reference/android/webkit/ValueCallback<https://developer.android.com/reference/java/util/Map<K, V>> callback) ` Gets the origins currently using the Web SQL Database APIs. |
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#getQuotaForOrigin(java.lang.String,%20android.webkit.ValueCallback<java.lang.Long>)(https://developer.android.com/reference/java/lang/String origin, https://developer.android.com/reference/android/webkit/ValueCallback<https://developer.android.com/reference/java/lang/Long> callback) ` Gets the storage quota for the Web SQL Database API for the given origin. |
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#getUsageForOrigin(java.lang.String,%20android.webkit.ValueCallback<java.lang.Long>)(https://developer.android.com/reference/java/lang/String origin, https://developer.android.com/reference/android/webkit/ValueCallback<https://developer.android.com/reference/java/lang/Long> callback) ` Gets the amount of storage currently being used by the Web SQL Database APIs by the given origin. |
| ` void` | ` https://developer.android.com/reference/android/webkit/WebStorage#setQuotaForOrigin(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String origin, long quota) ` *This method was deprecated in API level 18. Controlling quota per-origin will not be supported in future.* |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### deleteAllData

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

### deleteOrigin

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `origin` | `String` <br /> |

### getInstance

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static WebStorage getInstance ()
```

Gets the singleton instance of this class.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/webkit/WebStorage` | the singleton `https://developer.android.com/reference/android/webkit/WebStorage` instance <br /> |

### getOrigins

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/webkit/ValueCallback`. The origins are provided as a map, of type `Map<String, WebStorage.Origin>`, from the string representation of the origin to a `https://developer.android.com/reference/android/webkit/WebStorage.Origin` object.

<br />

| Parameters ||
|---|---|
| `callback` | `ValueCallback` <br /> |

### getQuotaForOrigin

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/webkit/ValueCallback`.

<br />

| Parameters ||
|---|---|
| `origin` | `String` <br /> |
| `callback` | `ValueCallback` <br /> |

### getUsageForOrigin

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/webkit/ValueCallback`.

<br />

| Parameters ||
|---|---|
| `origin` | `String` <br /> |
| `callback` | `ValueCallback` <br /> |

### setQuotaForOrigin

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setQuotaForOrigin (String origin, 
                long quota)
```

<br />

**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.

<br />

| Parameters ||
|---|---|
| `origin` | `String` <br /> |
| `quota` | `long` <br /> |