菜鸟教程小白 发表于 2022-12-12 13:36:32

javascript - html 存储 safari 隐身模式,angular2


                                            <p><p>当 Safari 在 iphone 6 plus 的 IOS 中处于私有(private)模式时,我无法在 HTML 本地/ session 存储中保存任何数据。谁能帮我解释为什么会发生这种情况。是否有可能超越它并使其存储数据? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>可能重复:
<a href="https://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an" rel="noreferrer noopener nofollow">html5 localStorage error with Safari: &#34;QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.&#34;</a> . </p>

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

<pre><code>try {
      localStorage.setItem(&#34;check&#34;, &#34;test&#34;);
      console.log(&#34;works!!&#34;);
    } catch (exception) {
      console.log(&#39;browser / mode not supported&#39;);
    }
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于javascript - html 存储 safari 隐身模式,angular2,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45301598/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45301598/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: javascript - html 存储 safari 隐身模式,angular2