Git Product home page Git Product logo

Comments (5)

nbubna avatar nbubna commented on May 25, 2024

when you say it's "not initializing", do you mean that it is throwing an error? or just that it is using fake storage? if it is the latter, then that is what's supposed to happen when localStorage is not available. you can test it via store.isFake()

Regarding your fix, store should always be an alias for store.local, never store.session. that's too confusing of a change to substitute sessionStorage when people are expecting local. i think it's better to stick with the fake. If you want your app to fall back to sessionStorage when localStorage is fake, then just add this test to your code:

if (store.isFake()) {
    store = store.session;
}

But i don't think it's wise to do that by default. Alternatively, you could include the store.old.js extension which will try to replace localStorage with an IE userData polyfill when store.isFake()

from store.

henkli avatar henkli commented on May 25, 2024

Hi,

I'll add more details.

I got an error on line 201 with the following message: "This function is not supported on this system."
This is the line in question:

var store = window.store = _.Store('local', localStorage);

I verified that just reading localStorage threw that error. Interestingly checking the type of localStorage as such:

typeof(window.localStorage)

returned 'unknown', not 'undefined'. I am not sure, but this looks rather strange. I can only reproduce this problem on IE10 running in 32 bit mode via Selenium's IE proxy. When running IE10 normally (i.e. not via Selenium), localStorage works just as expected. I suspect it has something to do with unsufficient permissions for localStorage, but I am unable to verify that for sure. Anyway, it seems that IE10 can react in this way, and since we want to use store.js, we need to work around this.

Currently we are using a slightly modified version to ignore the missing localStorage, but it would be nicer to incorporate the change into the main branch, if you will.

from store.

nbubna avatar nbubna commented on May 25, 2024

Ah, an thrown error. Yes, i'll put a fix in the main branch. I think you are right that it is probably a permissions error, but i'm not set up to test IE10 32 bit. I'll have to let you test this for me and confirm the fix.

My preferred fix is to do a try/catch in an IIFE, as i do for sessionStorage (FF throws errors for sessionStorage when used in local filesystem). I'll push the change, when you test it and confirm the fix works, i'll tag a new release.

So you know, the fix will mean that store.isFake() will return true (data only survives while the page is up), but it should not give you any errors.

from store.

nbubna avatar nbubna commented on May 25, 2024

Ok, the purported fix is in the main branch, please let me know ASAP if it does the trick.

from store.

henkli avatar henkli commented on May 25, 2024

It works beautifully. Thank you!

from store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.