我正在使用为
Linux Mint构建的Firefox 21.当尝试从脚本标记内打开IndexedDB数据库时,我得到一个InvalidStateError.但是,尝试从
JavaScript控制台打开数据库时,我不会收到错误.
以下代码给出了错误
<html>
<body>
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
indexedDB.open("MyNewDatabase");
});
</script>
</body>
</html>
输入indexedDB.open(“MyNewDatabase”);在控制台中正确返回IDBOpenDBRequest对象.什么可能导致这种奇怪行为的想法?
我知道Invalid state Error in Firefox for Indexed Db和InvalidStateError while opening IndexedDB in Firefox,但这两个问题/答案都无法帮助我找出问题所在.
最佳答案 这个回复可能为时已晚,无法使用,但您是否在about:config中检查了dom.indexedDB.enabled pref是否为真?
我最后阅读了Gecko indexedDB源代码,发现由于未知原因我在过去将该pref翻转为false!