diff --git a/js/db.js b/js/db.js index 17b6f9b8..234f03e5 100644 --- a/js/db.js +++ b/js/db.js @@ -24,6 +24,9 @@ define( } } }, + Capable: function() { + return typeof indexedDB != "undefined"; + }, // Turn on/off debug logging. ToggleDebug: function() { this.debug = !this.debug; diff --git a/js/tagging.js b/js/tagging.js index 518bdd92..4a691970 100644 --- a/js/tagging.js +++ b/js/tagging.js @@ -12,7 +12,7 @@ define( // callbacks.error is expected to be a function that takes // an IDBRequest as an argument. UpdateTags: function(ref, tags, callbacks) { - db.Transaction( + db.Capable() && db.Transaction( [tagStore], function(trans) { db.Update( 'tags', ref.toString(), @@ -27,7 +27,7 @@ define( // callbacks.error is expected to be a function that takes // an IDBRequest as an argument. GetTags: function(ref, callbacks) { - db.Get(tagStore, ref.toString(), + db.Capable() && db.Get(tagStore, ref.toString(), {success: function(req) { var data = req.target.result; // TODO suppport book and chapter indexes for