diff --git a/browser-index.js b/browser-index.js index b6b8541a2..71b81f3ae 100644 --- a/browser-index.js +++ b/browser-index.js @@ -1,13 +1,16 @@ var matrixcs = require("./lib/matrix"); matrixcs.request(require("browser-request")); -matrixcs.setCryptoStoreFactory( - function() { - return new matrixcs.IndexedDBCryptoStore( - global.indexedDB, "matrix-js-sdk:crypto" - ); - } -); +// if our browser (appears to) support indexeddb, use an indexeddb crypto store. +if (global.indexedDB) { + matrixcs.setCryptoStoreFactory( + function() { + return new matrixcs.IndexedDBCryptoStore( + global.indexedDB, "matrix-js-sdk:crypto" + ); + } + ); +} module.exports = matrixcs; // keep export for browserify package deps global.matrixcs = matrixcs;