IndexedDB Support in Chrome Browser

What is IndexedDB?

  • IndexDB (Index Database) is a low-level API for storing significant amount of data in the client-side, including file/blob.
  • It is a document database (NoSQL or Object) that exist in sandbox context entirely within the browser and provides a way to store large amounts of data on your user’s browser.
  • The below figure highlights the structure of database in IndexDB.

indexdb

  • You can also choose cookies and local storage for storing data but they don’t offer database usability the way IndexDB do.

Why use IndexDB?

  • IndexDB is a transactional database system similar to an SQL-based RDBMS. However, unlike SQL-based RDBMS, IndexDB is a javascript-based object oriented database, which does not use fixed column tables,
  • IndexDB stores key-value pair and let you store and retrieve objects that are indexed with a key.
  • The data stored in IndexDB is persistence. It offers rich query abilities and is available both in online and offline mode.
  • IndexDB also offers a powerful indexed based searching API to retrieve the data you need.

Checking IndexDB Compatibility in Chrome Browser

To open and configure database operations, you need to assure that your browser supports IndexDB. Implement the below code in your application in order to check the IndexDB compatibility in chrome browser.

window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;

if(!window.indexedDB){

console.log("Your Browser does not support IndexedDB");

}

If the browser is supporting IndexDB, you can open and configure the database.

Issues While Checking IndexDB Compatibility

While checking IndexDB compatibility in chrome browser, we have faced one issue. When we were using older chrome version, the code which we implemented to check IndexDB compatibility was working fine.

Here is the code snippet we used on older version.

window.indexedDB = window.$indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;

if(!window.indexedDB){

console.log("Your Browser does not support IndexedDB");

}

But, after we upgrade our chrome version to 57.0.2987, the IndexDB is not supporting the latest chrome browser. To fix this issue, we made one small change in the above OR condition. We removed ‘$’ symbol from window.$indexedDB. After making this change, the IndexDB is supporting the latest browser.

Find below the working code snippet.

window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;

if(!window.indexedDB){

console.log("Your Browser does not support IndexedDB");

}

IndexDB is appropriate to handle large amounts of data and to perform complex search queries. It uses indexes to store the data and transactions to perform operations.

FacebookTwitterGoogle+Share
About Mahesh Devda

Mahesh Devda is working at Vmoksha Technologies as a Software Engineer. He is a graduate in information technology from Mumbai University and has a strong passion towards coding & learning new technologies. He is a fun loving person who loves to travel and meet new people.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>