In Chrome (tested on version 29) you can now access webSql, just don't use window
var db=window.openDatabase(....);
use instead
var db=openDatabase(....);
Also, when calling executeSql be sure to write the error message in the second callback function. This is useful to see where the error is.
var db=openDatabase('myDB', '', 'my first database', 2 * 1024 * 1024); db.transaction(function(tx){ tx.executeSql('CREATE TABLE IF NOT EXISTS foo (id unique, text)',[],function(tx,results){ self.postMessage("passed"); },function(_trans,_error){self.postMessage(_error.message)}); tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "synergies")',[],function(tx,results){ self.postMessage("passed"); },function(_trans,_error){self.postMessage(_error.message)}); });
source share