This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

abort

Summary

The abort method is used to abort a transaction. Once called, the abort method follows the steps to abort a transaction

Method of apis/indexeddb/IDBTransactionapis/indexeddb/IDBTransaction

Syntax

 transaction.abort();

Return Value

No return value

Examples

var dbOpenRequest = window.indexedDB.open("BookShop1");
dbOpenRequest.onsuccess = function (event) {
    var db = dbOpenRequest.result;
    try {
        var transaction = db.transaction(["ObjectStore_BookList"], IDBTransaction.READ_WRITE);

        // Now that the transaction is created, lets abort it !!
        transaction.abort();
    } catch (e) {
        write("Could not open transaction");
    }
};

View live example

Usage

 If the transaction is finished, a DOMException of type InvalidStateError is thrown. Otherwise, the steps to abort a transactions are run.

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

Attributions