IDBVersionChangeRequest.setVersion()

The IDBVersionChangeRequest.setVersion method updates the version of the database, returning immediately and running a versionchange transaction on the connected database in a separate thread.

For older WebKit browsers, call this method before creating or deleting an object store.

Warning: The latest draft of the specification has dropped this method. Some not up-to-date browsers still implement this method. The new way is to define the version in the IDBDatabase.open() method and create and delete object stores in the onupgradeneeded event handler associated with the returned request.

Syntax

JavaScript
<a href="dom/idbversionchangerequest"><code>IDBVersionChangeRequest</code></a> <a href="dom/idbversionchangerequest/setversion#setVersion"><code>setVersion</code></a> ([TreatNullAs=EmptyString] in <a href="dom/DOMString" title="DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String."><code>DOMString</code></a> <code>version</code>);

Example

JavaScript
TBD

Parameters

version
The version to store in the database.

Returns

IDBVersionChangeRequest
The request to change the version of a database.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support Not supported Not supported Not supported Not supported Not supported
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support Not supported Not supported ? Not supported Not supported

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/idbversionchangerequest/setversion

API Method NeedsExample Obsolete Reference Référence