简体   繁体   中英

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. 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." .

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.

You can store data in cookies instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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