測試 IndexedDB 可用性

你可以通過檢查 window.indexedDB 屬性的存在來測試當前環境中的 IndexedDB 支援:

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