Saturday, October 8, 2016

Safari Browser does not allow session storage in case of private browsing mode and throws the exception of 0 quota.

To overcome that problem, You should always put your session storage code in try and catch. If any exception comes you can save the information in cookie, But You should be careful about cookie data, As cookie does not allow non ascii character in safari, But some browsers allow them in cookie.

If there is semi colon ";" as a character in cookie value then cookie value will be truncated after that and wont be saved properly in any type of browser, To overcome this problem you have to use encodeUriComponent method on the value before saving it in cookie. For fetching the right value you can use decodeUriComponent method.

Happy coding :).

0 comments:

Post a Comment

Powered by Blogger.

Followers

Best Price Amazon Portal

Amazon Best Offers