简体   繁体   English

html Safari Safari隐身模式,angular2

[英]html storage safari incognito mode, angular2

I am not able to save any data in HTML local / session storage when safari is in private mode in IOS in iphone 6 plus. 当Safari在iPhone 6 Plus的IOS中处于私有模式时,我无法在HTML本地/会话存储中保存任何数据。 Can anyone help me with why this could be happening. 谁能帮助我解决为什么会这样。 Is it possible to over ride it and make it store data? 是否有可能过度使用它并使其存储数据?

possible duplicate : html5 localStorage error with Safari: "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota." 可能重复: Safari出现html5 localStorage错误:“ QUOTA_EXCEEDED_ERR:DOM异常22:试图向存储中添加超出配额的内容。” .

You can write a script and on exception ask user to open your website in normal mode or in a different browser 您可以编写脚本,并在异常情况下要求用户以正常模式或在其他浏览器中打开您的网站

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

Well, the reason is itself the browser, actually, Safari exposes the localStorage object, but it refuses to store any value. 好吧,原因是浏览器本身,实际上Safari公开了localStorage对象,但是它拒绝存储任何值。

You can store data in cookies instead. 您可以将数据存储在Cookie中。

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

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