1

我在这里制作了一个原型应用程序,可以在我的机器上运行(FF 13.0.1)。为了进行更多测试,我尝试查看用户第一次访问它时的行为。所以我打开了一个虚拟机并运行它。问题是我没有收到浏览器关于我的应用程序的本地数据库使用情况的任何许可请求,因此我的应用程序没有按预期运行。然而,当我在寻找一些明确的权限设置时,firefox 询问了我想给我的应用程序访问本地数据库使用的 id。在那之后,我的应用程序工作了。

那么,如何强制 Firefox 向用户询问有关我的应用程序使用 IndexedDB 的权限?

谢谢!

4

1 回答 1

2

In Chrome, you're asked permissions when IndexedDB installs for the first time on a host (origin, port and protocol matching), but this is apparently not the default behavior in Firefox.

According to this helpful Mozilla support ticket, there seem to be two types of permissions in FF: "indexedDB" and "indexedDB-unlimited." Only the latter comes into play; the user doesn't have to grant permission until the 50mb ceiling is reached.

The ticket describes expected behavior as allowing IDB by default and not seeing a prompt:

Expected - app should finish loading and allow indexed DB by default without a prompt

If you'd like to control permissioning consistently in a cross browser way, I suggest you take matters in your own hand as the spec does not proffer a way that browsers should be going about this and we can see Chrome and Mozilla teams already disagree.

For example, store a "1" in localStore when the user grants permission and a "0" when she denies it. Refuse to open a database for someone with a "0" and prompt for permissions for those with an "undefined" as a flag.

于 2012-07-02T20:44:57.547 回答