I am trying to use jStorage on my site built on jQuery Mobile. It works fine on Chrome, Firefox, Android, some versions of Mobile Safari, and on IE 10 mobile on Windows Phone 8. It gives me an 'undefined' error when I try to set any value.

For example, $.jStorage.set("FBID", response.authResponse.userID);

I have this issue on iPhone 5 (Safari 6.1) and iPhone 4S (Safari 6.0)

Enabling local storage on Safari does not help.

Any ideas or suggestions you could come up with?

有帮助吗?

解决方案

Found the issue.... localStorage does not work on iOS when private browsing is switched on. When using jStorage, this causes error. Use the following if condition to ensure it does not show an error when browsing privately..

if($.jStorage.storageAvailable())
     $.jStorage.get(key);

其他提示

If you do a web search for "iOS 5 localstorage bug" you see that it's been broken in Mobile Safari for a while. jStorage utilizes HTML5 localstorage, thus why it does not work.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top