One of our small applications, using Localstorage to do the next cache, test on-line after the feedback page data is not pulled,
Finally, the localstorage is a problem.
is the private browsing mode caused. Then view iOS safari without discovering privacy settings or something
Then click on the lower right corner of the small box to find a non-mark browsing mode. MD, everything's fine after it's closed.
Copy Code
//Safari, in Private browsing Mode, looks like it supports localstorage but all calls to SetItem
//Throw Q Uotaexceedederror. We ' re going to detect this and just silently drop all calls to SetItem
//To avoid the entire page breaking, without ha Ving Tsun to does a check at each usage of Storage.
if (typeof localstorage = = = ' object ') {
try {
Localstorage.setitem (' Localstorage ', 1);
Localstorage.removeitem (' localstorage ');
} catch (e) {
Storage.prototype._setitem = Storage.prototype.setItem;
Storage.prototype.setItem = function () {};
Alert (' Your Web browser does not support storing settings locally. In Safari, the most common cause of that is using "Private browsing Mode". Some settings may not be save or Some features may isn't work properly for you. ');
}
}
Copy Code
. Prompts the user to turn off the non-marking mode.
***************************************************
try {
Localstorage.setitem (key, D);
} catch (e) {
Alert ("You are in a no-trace view and cannot be saved for you");
}
The Pit of iOS