This question is locked. New answers and comments are not allowed.
The following code works in the simulator and on an Android tablet, but is not working on an iPhone. Does anyone have any suggestions?
var
dbsql = openDatabase(
'testWebSQL'
,
'1.0'
,
'Test Web SQL DB'
, 2 * 1024 * 1024);
dbsql.transaction(
function
(tx) {
tx.executeSql(
'CREATE TABLE IF NOT EXISTS Customers (ssn unique, name)'
);
});
function
getWebSQLCustomers() {
dbsql.transaction(
function
(tx) {
tx.executeSql(
'SELECT * FROM Customers'
, [],
function
(tx, results) {
var
len = results.rows.length;
var
i;
for
(i = 0; i < len; i++)
alert(
'WebSQL: '
+ results.rows.item(i).name);
},
null
);
tx.executeSql(
'INSERT INTO Customers (ssn, name) VALUES (?, ?)'
, [
'123'
,
'Bill'
]);
});
}
// getWebSQLCustomers() is called by a button click event and after the first click shows an alert on Android but not on an iPhone