OGeek|极客世界-中国程序员成长平台

标题: javascript - html 存储 safari 隐身模式,angular2 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 13:36
标题: javascript - html 存储 safari 隐身模式,angular2

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



Best Answer-推荐答案


可能重复: 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');
    }

关于javascript - html 存储 safari 隐身模式,angular2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45301598/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4