2 Replies Latest reply on Jan 23, 2012 8:11 AM by Ord Millar

    Session Variables

      Hi,

       

      is there a recommended way to store session variables for passing between pages in an offline rhoelements application?

       

      I need a way for a user to log in, and then I will have to pass the userID and two or three session variables between pages as the user navigates through the application. It seems like it might be possible to do it with cookies, a state file, a database or the registry - is any one method preferred?

       

      Thanks,

      Ord

        • Re: Session Variables
          Robert Galvin

          Hi Ord

           

           

           

          You should be using the HTML5 Localstorage feature.

           

           

           

          //Save a value to localStorage

           

          localStorage.setItem('key', 'value to save');

           

          //OR

           

          localStorage.key = 'string value to save'; 

           

           

           

          //Get the value back out of localStorage

           

          localStorage.getItem('key');

           

           

           

          //OR

           

          localStorage.key; 

           

           

           

          //Clear all localStorage values

           

          localStorage.clear();

           

           

           

          This data will persist until the application clears it (unlike Session variables that only last the session)