测试 IndexedDB 可用性

你可以通过检查 window.indexedDB 属性的存在来测试当前环境中的 IndexedDB 支持:

if (window.indexedDB) {
    // IndexedDB is available
}