Localstorage under Safari under iOS doesn't work

Source: Internet
Author: User

One of our small applications, using the Baidu Map API to obtain the user's coordinates after using Localstorage to do the next cache, test on-line after the operation of the student Feedback page data pull,

The test did not find the problem, and 2 of the same iphone one can not be one, and finally locate the problem is localstorage.

But why is it obvious that the same version of the 2 mobile phone one can not be a single?

and 2 mobile phone printing localstorage is obviously an object, strange.

In the degree Niang did not find the answer, finally to Google found someone said isPrivate Browsing Mode引起的。然后查看IOS的safari没有发现隐私设置什么的

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.

//Safari, in Private browsing Mode, looks like it supports localstorage but all calls to SetItem//throw quotaexceedederror. We ' re going to detect this and just silently drop any calls to SetItem//to avoid the entire page breaking, without has a check at each usage of Storage.if(typeofLocalstorage = = = ' 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. '); }}

Can Jiangzi judgment. Prompts the user to turn off the non-marking mode.

or http://stackoverflow.com/questions/14555347/. Html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an there are other

People write some methods that I haven't tried. You guys can try.

Localstorage under Safari under iOS doesn't work

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.