What are iPhone Safari Databases?

Question

Recently, I was poking around under my Safari Settings (Settings –> Safari) on my iPhone and came across an entry for databases. What are these?

Answer

iPhone Safari supports HTML 5’s client-side storage structure just as your desktop version of Safari (Safari –> Preferences –> Security –> Show Databases). It is useful for developing off-line capabilities for web-apps. They happen when you go to a website that has implemented the technology.

The idea is if you can store some information on your iPhone that you normally retrieve when visiting a website, your experience can be better/quicker.

Here is an example quoted from the W3:

…designed for scenarios where the user is carrying out a single transaction, but could be carrying out multiple transactions in different windows at the same time.

Cookies don’t really handle this case well. For example, a user could be buying plane tickets in two different windows, using the same site. If the site used cookies to keep track of which ticket the user was buying, then as the user clicked from page to page in both windows, the ticket currently being purchased would “leak” from one window to the other, potentially causing the user to buy two tickets for the same flight without really noticing.

To address this, this specification introduces the sessionStorage DOM attribute. Sites can add data to the session storage, and it will be accessible to any page from the same site opened in that window.

For example, a page could have a checkbox that the user ticks to indicate that he wants insurance… A later page could then check, from script, whether the user had checked the checkbox or not.

If the user had multiple windows opened on the site, each one would have its own individual copy of the session storage object.

The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user’s mailbox, on the client side for performance reasons.

Again, cookies do not handle this case well, because they are transmitted with every request.

If you want all the really gory technical stuff, you can read about it here.

While all major browsers (except for Microsoft Internet Explorer) seem to support much of what HTML5 has to offer currently — the World Wide Web Consortium (W3.org) has not reached a recommendation on using it yet. It is expected to be recommended by late 2010. I imagine at that point you will see a lot more usage of the databases. However, since the iPhone only has one browser to contend with, it is easy for iPhone developers to make the decision to take advantage of those databases. Complete implentation of HTML5 for the Word Wide Web won’t happen for years though – so don’t hold your breath while you wait.

Update

I have been getting tons of email asking various questions about the security of Safari Databases. You can see some of the questions in the comments. Everyone seems to be paranoid about them and are scared they are some rogue attempt to send information to 3rd parties. This is not the case. It’s just a way for information you have already supplied to a website to be stored on your iPhone so if you ever go back to that website it will be available and improve your user experience. Feel free to delete them with abandon if they make you nervous. But, they shouldn’t. I encourage you to read through some of the documentation here if you are still nervous. Once you understand, you won’t be.

Posted in ,

Lena Shore

Lena is a full-time freelancer and nerd that specializes in web development, graphic design, and illustration. She enjoys building things, learning new things, pursuing creative endeavors, and giving free advice.

31 Comments

  1. Phillipa on September 16, 2011 at 2:36 pm

    I just recently noticed the Databases tab in my settings and went through it. I deleted everything, but there was an email address on there of someone I let use my phone once and an anonymous twitter as well. My question – is it possible that any info on my phone,including my email,would be sent to the email I found/person who used my phone? If no, would it make a difference if their phone was jailbroken?



    • Lena Shore on September 18, 2011 at 7:55 am

      The purpose of the database is to make it easier for YOU to access a website a second time. The data is on your phone. Not the website they visited. Sounds like your friend went to a website, entered their email address and the website basically asked your phone if it wanted to store that information on your phone so it would be easier to access the site next time. If the website was sent any information it was information your friend gave it (like the email address).

      That being said, anything is possible. If your friend knows how to break into the iOS and write programming to specifically pass your phone information to miscellaneous websites then I guess the answer is ‘yes’. But, I would find it highly unlikely.



  2. Ty85 on September 12, 2011 at 9:39 am

    Hi! I was wondering what I found on my Iphone Safari database section. I found what was named “anonymous feed” from twitter, and I do not use Twitter. Have I been hacked? I deleted it as soon as I found it.



    • Lena Shore on September 12, 2011 at 10:35 am

      I doubt you’ve been hacked. My guess is that “anonymous feed” happens when there is some Twitter issue where it doesn’t show the feed properly. Still , deleting it won’t hurt anything. (:



  3. Ron on September 4, 2011 at 1:25 am

    Is there any way to prevent safari from accepting these databases?
    Thanks



    • Lena Shore on September 4, 2011 at 10:28 am

      Safari isn’t “accepting” anything. Safari creates the database for your convenience on your device. Think of it as browser cache. When you go to a website, your browser stores images and other info from that website in your browser cache, so the next time you go to that same page, it loads faster. This is the same concept. It is the nature of using a browser. Creating databases is just a way for the browser to grab a little extra information to make your experience more seamless.

      There is no easy way to change the functionality of your iPhone/iPad Safari browser. I suppose you could hack the application and disable it if you had the knowledge to do so.



  4. ParadiseMobi on July 30, 2011 at 8:49 am

    FYI re multiple gmail databases in iphone Settings/Safari/Databases:

    Today I decided to delete just ONE of the iphone Safari databases for ONE new gmail addy that I knew had NO content in it yet in my iphone Mail app.

    (For 2 years I have wanted to delete all those gmail databases in Settings/Safari/Databases but was chicken that it might delete something in my gmails in my iphone Mail app).

    GREAT NEWS, all Gmail databases are now deleted from iphone Safari databases & no harm done whatsoever as all addys are just fine in the Mail app! (That news may have been obvious to tech geeks all along, but I wasn’t 100% sure so hesitated all this time!)

    For other dummies like me, here’s the deal, like the above article basically says (which is what gave me the courage to start deleting):

    Gmail addy databases end up in your iphone Safari Databases whenever:
    1. You go to google website & create a new gmail; &/or…
    2. You visit your gmail anytime thereafter via the WEB/Safari (vs. just using the iphone Mail app).

    So have no fear, feel free to delete delete delete all those annoying gmail databases under Settings/Safari/Databases! It will NOT affect those same gmail addys in your iphone Mail app!



  5. Nasir Abbasi on July 11, 2011 at 8:56 am

    Can we take backup of Safari cache, that store in form of SQlite Database.



    • Lena Shore on July 11, 2011 at 9:01 am

      I don’t have much knowledge in this arena. You might check out File Juicer or iPhone Backup Extractor and see if it will do what you want.



  6. Nasir Abbasi on July 11, 2011 at 2:44 am

    Can we take Backup of Safari Database



    • Lena Shore on July 11, 2011 at 8:42 am

      Nasir – could you rephrase your question? I’m not quite understanding. (:



  7. doug on June 9, 2011 at 8:31 pm

    I noticed that “databases” is no longer under Safari settings. Any reason for this, was it removed in the latest version?



    • Lena Shore on June 13, 2011 at 9:59 am

      It’s still there. Could be you just haven’t gone to any sites that utilize them.



  8. Beth on April 15, 2011 at 3:48 pm

    if i delete the email addresses under settingsdatabases will they return again if the email account is accessed from my iphone?



    • Lena Shore on April 15, 2011 at 4:29 pm

      You can certainly delete them. They only make a difference when you are visiting the website that created the database. So, if you visit the website again, they will appear again.



    • Gavin on June 1, 2011 at 10:33 am

      I notice when I login to a yahoo email account or do a search on the yahoo browser they both create databases, whereas logging into a hotmail account or searching on google do not create datebases. Does anyone know why that is?



      • Lena Shore on June 1, 2011 at 5:26 pm

        Not specifically. But, I imagine they are just making it easier for you to do future searches. You could read their privacy policy and find out more I bet.



  9. Beth on April 14, 2011 at 6:12 pm

    i recently loaned my iphone to a friend and happened to notice there were 3 new email accounts listed within my settings under “databases”. How would these appear all of a sudden?



    • Lena Shore on April 15, 2011 at 9:22 am

      They happen when you go to a website that has implemented the technology.



  10. Jared on December 15, 2010 at 9:55 am

    Can I prevent my e-mail accts from showing in my Safari database every time I sign in to them??



    • Lena on December 15, 2010 at 10:31 am

      These databases only store what you’ve given them for a particular website. And, are only read if you go back to that same website. However, you could make a habit of deleting the databases after you visit a site that activates a database.



      • Lina on June 24, 2011 at 7:27 am

        How do you delete the database after you visit that site that activates the database?



        • Lena Shore on June 24, 2011 at 8:04 am

          I can’t test this – but I suspect if you clear your history, cookies, and cache that would do it.



  11. Braylon on November 29, 2010 at 7:37 am

    Are there any other websites that u can add to databases?



    • Lena Shore on November 29, 2010 at 7:47 am

      Braylon – I’m not sure I understand your question. Lots of websites have databases behind the scenes that populate the site. And, any website could have a database added to it if adding functionality to that site that warranted it.



  12. Joe on October 3, 2010 at 3:12 pm

    Does databases send history alertes to listed email accounts



    • Lena on October 3, 2010 at 9:12 pm

      Not that I am aware of. You would have to set that up on your end (if it was available) as a client side action. In theory, I would assume the capability is there. But, I doubt anyone has done that yet.



  13. Carsten on July 27, 2010 at 4:42 pm

    Accidently, I no longer have the “Database” under Security of Safari Settings. Any idea how to become it avaialbe / visuable again?



    • Lena on July 29, 2010 at 10:29 am

      I believe it only shows up when you’ve visited a website that utilizes them and thereby has information to display. (:



  14. Scott on July 15, 2010 at 5:33 am

    Usually just mobile of these



  15. Swami on June 23, 2010 at 4:29 am

    When I delete a database from my iPhone preferences, it appears again in settings > safari. This is true even if my safari has just one blank browser window open and have deleted cookies, cache, and history.

    If I delete it twice, it does not return until I revisit the offending webpage. Thanks.



Archives