Threaded View

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    103
    Answers
    5
    Vote Rating
    10
    pepperseb is on a distinguished road

      0  

    Default Answered: LocalStorage - Multiple applications on the same domain issue

    Answered: LocalStorage - Multiple applications on the same domain issue


    Hey Sencha world,
    On the same domain I run my app which is basically an e-commerce app with a shopping cart where items are saved in the localStorage.

    The app takes a company parameter on startup.

    Problem:
    If I run the app as company A, I have some products stored into the localstorage.
    Now, I run the same app as company B (= differents products), I still have the old company A's products referenced in the same localStorage.

    As a result, if I add a product to my shopping cart, I end up with product refs from company A and B which is obviously not acceptable..

    My idea of what's happening:
    The localStorage is shared between the two companies because the app is running on the same domain with the same localStorage identifier. The solution might be to have different localStorage ids for each company.

    But, how can I do it?

    Thanks in advance for any answer.

  2. Make the localstorage proxy id dependent on Company id.



    proxy:{ type:'localstorage', id :'storedProducts-'+companyId}

Thread Participants: 1

Tags for this Thread