Re: [IndexedDB] Problems unprefixing IndexedDB

On 8/8/12 8:12 PM, Tab Atkins Jr. wrote:
> Just for reference, the correct way to do this is:
>
> window.indexedDB = window.indexedDB || window.webkitIndexedDB ||
> window.mozIndexedDB || window.msIndexedDB || ...
>
> This avoids the var hoisting that's causing the problems.

As long as you're not in strict-mode code.  If you are, you have to be a 
bit smarter and actually condition things on |if (!("indexedDB" in 
window))| of course...

-Boris

Received on Thursday, 9 August 2012 00:22:46 UTC