Invalid status error, DOM 11 exception in Mobile Safari causing openDatabase

I have a webapp that calls openDatabase () on init. This works great on Chrome and Safari desktop browsers; however, when I try to open the application in Mobile Safari on iOS 4.3.3, I get an exception when loading the first page:

"Error: INVALID_STATE_ERROR: DOM 11 exception"

This does not work in openDatabase () inside a simple function:

       try {
            if( !window.openDatabase) {
                console.log('SQLite is not supported by this browser');
            }
            else {
                db = openDatabase('MyMobileDb', '1.0', 'MyMobileDb', 65536);
                if (doreset)
                {
                    //my drop and reset DB function
                } else
                {
                    //my init DB function
                }
            }
        }
        catch(e) {
            console.log(e);
        }

The database is not created and further interaction with the application is not possible. Other developers working with earlier versions of iOS do not face this problem with the same code. I also get reports from our QA team that Android presents similar behavior. Android 3.1 works, but 2.2 and 2.1 do not.

, ?

+3
2

WebSQL, , iOS 4.3.3 Safari OK.

INVALID_STATE_ERROR: DOM Exception 11 , , , WebKit, , . , -, ...

FWIW . "kinda" factory, , , , (, factory " , SQL, Javascript DAO, ).

gist 'factory' ( , ): http://gist.github.com/1044759

(), .

script (, $(document).ready), db:

// Initialise local db
var mydb = new DbConnection().getDb();

, Javascript , mydb , ..:

mydb.transaction(function(transaction){
  transaction.executeSql(...

, .

+2

, , - , , , number .

+6

All Articles