I'm having troubles with HTML5 LocalStorage on my iPad and iPhone. I've developed a HTML5/CSS3/JavaScript (jQuery/jQuery Mobile) website and I'm trying to store a couple of pieces of data to LocalStorage (just a couple of small strings).
When I navigate to the website on either the iPad or the iPhone by simply opening Safari and typing in the URL, I get notification from Moderizr that localstorage is not supported, and, thus, my values are not saved on the device.
However, if I use the Save to Home Screen option, save an icon/link to my mobile website on the Home Screen, close "regular" Safari, and open the application using the Home Screen icon, Moderizr tells me localstorage is available, and my values are written and read as expected.
So, I'm confused. Why does it work after saving the link to the Home Screen but it doesn't work if I type the URL directly in Safari? Is there some trick I'm missing to make it work in both scenarios?
I've tried with both iOS 5.1.1 and 6. And, my settings are the basic defaults.
Thanks.
After many headaches, I think I got it figured out. HTML5 local storage and private browsing do not mix. I had private browsing on (in the Safari settings) and that appeared to be blocking local storage. Actually, an exception was being thrown but swallowed up by the browser (???). Once I turned private browsing off, everything appeared to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With