Icon Loading Data from Local Storage

You can use the TPersistentStorage Exists method to determine if a particular key exists in local storage, and the TPersistentStorage Items property to access a string by its key. The following example shows how to use a form method to check for a user's display preferences in local (not per-session) storage, and then load them if they exist, or initialize them if they don't:

uses WebCore, WebComps;

procedure TForm1.Form1Create(Sender: TObject);
begin
   DisplayPrefs:=TStringList.Create;
end;

procedure TForm1.Form1Destroy(Sender: TObject);
begin
   DisplayPrefs.Free;
   DisplayPrefs:=nil;
end;

procedure TForm1.InitDisplayPrefs;
begin
   with DisplayPrefs do
      begin
      Clear;
      Values['ShowMainMenu']:='True';
      Values['ShowToolBar']:='True';      
      end;
end;

procedure TForm1.SaveDisplayPrefs;
begin
   LocalStorage.Set('DisplayPrefs',DisplayPrefs.Text);
end;

procedure TForm1.LoadDisplayPrefs;
begin
   if LocalStorage.Exists('DisplayPrefs') then
      DisplayPrefs.Text:=LocalStorage['DisplayPrefs']
   else
      InitDisplayPrefs;
end;

Information The above code is not complete and is only a cut-down example to illustrate the specific local storage concepts discussed here.
Image