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.

警告: 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.

句法

IDBVersionChangeRequest setVersion ([TreatNullAs=EmptyString] in DOMString version);
					

范例

TBD
					

参数

version

The version to store in the database.

返回

IDBVersionChangeRequest

The request to change the version of a database.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
setVersion 弃用 非标 Chrome No Edge No Firefox No IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android No Opera Android No Safari iOS No Samsung Internet Android No

图例

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

弃用。不要用于新网站。

弃用。不要用于新网站。

另请参阅

元数据

  • 最后修改: