简体   繁体   English

无法在 Firefox for Android 中激活 navigator.storage.persist

[英]Can not activate navigator.storage.persist in Firefox for Android

StorageManager has an API to make offline storages persistent which make them not to suffer from purging when there is not enough free space on user's drive. StorageManager 有一个 API 可以使离线存储持久化,这使得它们在用户驱动器上没有足够的可用空间时不会受到清除的影响。 https://developer.mozilla.org/ru/docs/Web/API/StorageManager/persist https://developer.mozilla.org/ru/docs/Web/API/StorageManager/persist

I want to use persistant offline storage for my website.我想为我的网站使用持久离线存储。 Persistant mode can be activated using this code:可以使用以下代码激活持久模式:

navigator.storage.persist.then(
  function(persist_enabled) {console.log(persist_enabled)}
)

When this command is executed in Desktop FireFox version the browser prompts a permission and if a user allowed it persist_enabled is "true".在 Desktop FireFox 版本中执行此命令时,浏览器会提示权限,如果用户允许,则persist_enabled 为“true”。

But when I run this command in Android Firefox version there is no permission prompt and the result is always "false".但是当我在 Android Firefox 版本中运行此命令时,没有权限提示,结果始终为“false”。

Is there some condition I must to satisfy to turn this feature on on Adroid Firefox?在 Adroid Firefox 上启用此功能是否必须满足某些条件?

Update 2020.09.29 2020.09.29 更新

Firefox support team said that it is a bug. Firefox 支持团队表示这是一个错误。 The permission prompt must be popped up but it's not.必须弹出权限提示,但不是。 We should wait for a fix.我们应该等待修复。 https://github.com/mozilla-mobile/android-components/issues/3153 https://github.com/mozilla-mobile/android-components/issues/3153

There are bad news for current date (checked on 9'th september 2020 )当前日期有坏消息( 9'th september 2020日检查)

According to "Can i use" site ( https://caniuse.com/mdn-api_storagemanager ) this feature is not supported by default in Firefox 79 for Android .根据“我可以使用”站点 ( https://caniuse.com/mdn-api_storagemanager),Firefox Firefox 79 for Android默认不支持此功能。 It must be enabled via internal configuration.它必须通过内部配置启用。

So it's not possible to use this feature for a regular site for now as users probably would not enable it.因此,目前无法将此功能用于常规站点,因为用户可能不会启用它。

Upd.更新。 2020.12.11 There was a bug in Firefox for Android. 2020.12.11 Firefox for Android 中存在错误。 The prompt should popup but it's not.应该会弹出提示,但不是。 Here is a related issue in github: https://github.com/mozilla-mobile/fenix/issues/14875 The problem is solved now.这里是github中的一个相关问题: https : //github.com/mozilla-mobile/fenix/issues/14875现在问题解决了。

我在使用 chrome 时遇到了一些问题,我通过为应用程序添加书签来解决这个问题……因此,对于这个文档,浏览器遵循一些启发式方法来提示这个弹出窗口,有时他们可能会默默地拒绝许可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM