【问题标题】:html storage safari incognito mode, angular2html 存储 safari 隐身模式,angular2
【发布时间】:2017-12-31 06:42:38
【问题描述】:

当 safari 在 iphone 6 plus 的 IOS 中处于私有模式时,我无法在 HTML 本地/会话存储中保存任何数据。谁能帮我解释为什么会发生这种情况。是否有可能超越它并使其存储数据?

【问题讨论】:

  • 您遇到任何具体错误?
  • 如果你能输入一些代码和你得到的错误,那会很有帮助!

标签: javascript html ios angular safari


【解决方案1】:

嗯,原因在于浏览器本身,实际上,Safari 暴露了 localStorage 对象,但它拒绝存储任何值。

您可以将数据存储在 cookie 中。

【讨论】:

    【解决方案2】:

    可能重复: html5 localStorage error with Safari: "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota."

    您可以编写脚本并在异常情况下要求用户以正常模式或其他浏览器打开您的网站

    try {
            localStorage.setItem("check", "test");
            console.log("works!!");
        } catch (exception) {
            console.log('browser / mode not supported');
        }
    

    【讨论】:

      猜你喜欢
      • 2019-03-16
      • 1970-01-01
      • 2014-11-20
      • 2017-12-19
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      • 2017-07-17
      • 1970-01-01
      相关资源
      最近更新 更多