Skip navigation

LocalStorage object available in iBooks?

6957 Views 26 Replies Latest reply: Apr 8, 2013 7:58 PM by Richard Hercher1 RSS
  • tk0us Level 2 Level 2 (265 points)
    Currently Being Moderated
    Nov 14, 2012 3:52 AM (in response to multimedial)

    local storage is available but has a smaller than normal data limit (less than 5MB if memory serves)

     

    Yes user names can travel across books, widgets, and more

  • Shotster Calculating status...
    Currently Being Moderated
    Nov 14, 2012 8:27 AM (in response to tk0us)

    tk0us wrote:

     

    local storage is available...

     

    As I understand it, there are three types of "local storage". There is key-value storage via the sessionStorage and localStorage JavaScript (JS) objects, and there is relational database storage via the JS database class. The difference between sessionStorage and localStorage is how long the data persists, but both are simple key-value storage mechanisms. Database storage, on the other hand, allows for storage of much richer, more complex data using an SQL database.

     

    tk0us wrote:

     

    ...but has a smaller than normal data limit (less than 5MB if memory serves)

     

    What exactly is a "normal" data limit? Also, how did you come by the 5 MB value? Is it documented, or did you determine it empirically?

     

    tk0us wrote:

     

    Yes user names can travel across books, widgets, and more

     

    When you say "across books," do you mean across different books by the same author? And have you tested it? I'm a bit skeptical about that claim.

     

    But even if that's the case (which I doubt), I can't imagine that the local data of one book could be accessed by a different book from a different author.

     

    Lastly, what do you mean by "and more"? Can you elaborate?

     

    -Steve

  • tk0us Level 2 Level 2 (265 points)
    Currently Being Moderated
    Nov 14, 2012 9:56 AM (in response to Shotster)

    I believe from past investigations, the limit has been 2.5MB but I also believe that has been increased. As long as your local storage name remains the same, a user name can travel across all your books, much like I have done with many of mine. If a different author used my variables I believe they could access the data as well (haven't tried this).

     

    Most web browsers have between 5MB and 10MB depending upon the browser.

     

    You are correct, session storage only exists while the session is open. I have not had the need for database and have not tried it in Author.

  • Shotster Level 1 Level 1 (95 points)
    Currently Being Moderated
    Nov 14, 2012 10:22 AM (in response to tk0us)

    tk0us wrote:

     

    As long as your local storage name remains the same, a user name can travel across all your books, much like I have done with many of mine.

     

    That's really good to know. I'll have to try it with the DB.

     

    tk0us wrote:

     

    If a different author used my variables I believe they could access the data as well (haven't tried this).

     

    It would surprise me, but it'd be nice to have a definitive answer, as it could affect the type of information I'd be likely to store there. Seems like it might be a privacy (if not security) concern if that were possible.

     

    tk0us wrote:

     

    I have not had the need for database and have not tried it in Author.

     

    I have, and it works; although I haven't tried accessing the data from different books. I'll do some testing when I get a chance.

     

     

    Thanks for the info,

     

    -Steve

  • Thomas_101 Level 1 Level 1 (25 points)
    Currently Being Moderated
    Nov 15, 2012 3:06 AM (in response to multimedial)

    Hey,

     

    For anyone else who's looking at localStorage in widgets I've written a small blog post about it including some things you need to take into special consideration with iBooks Author. Hope it helps someone

    http://blog.bookry.com/?p=350

  • Shotster Level 1 Level 1 (95 points)
    Currently Being Moderated
    Nov 15, 2012 11:47 AM (in response to Thomas_101)

    Hey Thomas,

     

    Do you have any insights on the accessibility of local storage objects by other books - in particular, books by other authors?

     

    -Steve

  • Thomas_101 Level 1 Level 1 (25 points)
    Currently Being Moderated
    Nov 15, 2012 11:52 AM (in response to Shotster)

    I did a quick test yesterday and found that each book only has access to its own localstorage.

     

    So I couldn't for example save something in one book and load it in another. I think it's because a book is seen as a domain and obviously talking between books would come under cross domain leakage.

     

    Tom

  • tk0us Level 2 Level 2 (265 points)
    Currently Being Moderated
    Nov 15, 2012 12:13 PM (in response to Thomas_101)

    I have been able to use data across books by using the same variable name...

     

    I also have seen a limit of 2.5MB for iBook widgets

     

    hope this helps

  • Thomas_101 Level 1 Level 1 (25 points)
    Currently Being Moderated
    Nov 15, 2012 12:21 PM (in response to tk0us)

    What version of iBooks was this with? They've tightened up a few bits between iBooks 2 and 3. For example cookie rules have changed in iBooks 3.

     

    You might have noticed in iBooks 2 widgets were hosted on th-iBooks://(null) where as on 3 they are hosted on th-iBooks://a/proper/URL/

  • Shotster Level 1 Level 1 (95 points)
    Currently Being Moderated
    Nov 15, 2012 12:22 PM (in response to Thomas_101)

    Thomas_101 wrote:

     

    I did a quick test yesterday and found that each book only has access to its own localstorage.

     

    That's the behavior I would expect, but tk0us claims otherwise. I'll have to look into it when I get a chance.

     

    -Steve

  • tk0us Level 2 Level 2 (265 points)
    Currently Being Moderated
    Nov 15, 2012 2:49 PM (in response to Shotster)

    just checked and I can no longer go across books with local storage in iBooks 3.0.2

  • Richard Hercher1 Calculating status...
    Currently Being Moderated
    Apr 8, 2013 7:58 PM (in response to multimedial)

    I know this is a bit of an older thread, but if anyone is reading this, I have a question:

     

    I've been building a iBooks Author's-destined widget in Dashcode (starting with the interface layout tools), and hope to have users keep persistant data in the widget. The design is a blank role playing game character sheet. I also hope to duplicate the widget, making a few minor changes, and add multiple copies that have data filled in through out the book (but are also user modifiable).

     

    There's still some work to do, but this is a rough draft of the base widget. 

    https://www.dropbox.com/s/jub447tganpe0ao/Char_Sheet%20LocalStorage.dcproj.zip

     

     

    I have no java script experiance (I've been trying to squeeze some training in at codecademy.com, but it's slow going), and was wondering if someone could dumb down the process for me--

     

    Where to add code

    What the code pieces would look like

    How to get data from the fields into localStorage

     

    I know this is asking an aweful lot. I'm working on trying to understand this independantly, but I have little to no programming background. I've picked up the Dashcode for Dummies on Kindle, but it doesn't really focus on iBooks and doesn't talk about the localStorage function at all.  I'm trying to push through the javascript courses in codecademy and w3schools.com, but it's an uphill climb.  If anyone can offer any thing like what I've been looking for, I'll gladly include you in my dedication page!!

1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.