Search code examples
javascripttizentizen-web-app

How to handle data storage/pass values between pages in Tizen SDK?


How to handle cookie or data storage in tizen sdk with javascript. I'm looking for options to store my session details and the authentication details to validate, in all other pages.

My Scenario is I'm having an html/javascript application which will contact java servlet through AJAX for all the authentication and search functionality. In all the service calls i'm checking the session and the cookie to validate the login status of the user. First page "index.html" holds the login screen and navigate to another html page present in /WebContent folder on successful authentication. I couldn't able to access any information (Session/Cookie) in the second page which is stored through first page.

I'm looking for accessing these values in second page or anyother way to pass values between pages of an app


Solution

  • Javascript and HTML now offers the use of localStorages to keep name value pair data:

    // to store a value
    window.localStorage.setItem( 'item_name', item_value);
    
    // to retrieve a value
    item_value = window.localStorage.getItem( 'item_name' );
    
    // to delete a storage
    window.localStorage.removeItem( 'item_name' );
    

    Hope that helps.