LocalStorage: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "LOCALSTORAGE(''string'' | ''variable'') '''Description''' LOCALSTORAGE allows you to save string data so it is available next time you run the program. An entry can be creat..."
 
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
LOCALSTORAGE(''string'' | ''variable'')
LocalStorage(''string'' | ''variable'')


'''Description'''
== Description ==


LOCALSTORAGE allows you to save string data so it is available next time you run the program. An entry can be created by assigning to LOCALSTORAGE.''variableName'', where ''variableName'' is chosen by you. Data is retrieved the same way. A program is allowed to store at least 5 megabytes of data in LOCALSTORAGE. The information in LOCALSTORAGE is lost if the browser cache is cleared. To be certain that you do not lose data, save it into an SQLite database instead.
LocalStorage allows you to save string data so it is available next time you run the program. An entry can be created by assigning to LocalStorage.''variableName'', where ''variableName'' is chosen by you. Data is retrieved the same way. A program is allowed to store at least 5 megabytes of data in LocalStorage. The information in LocalStorage is lost if the browser cache is cleared. To be certain that you do not lose data, save it into an SQLite database instead.


LOCALSTORAGE is shared among all apps deployed from the same web server. This can be useful if you have a family of apps which need to share data.
LocalStorage is shared among all apps deployed from the same web server. This can be useful if you have a family of apps which need to share data.


Note that if the user has Private Browsing turned on, localStorage is not accessible.  
Note that if the user has Private Browsing turned on, localStorage is not accessible.  


'''Example'''
== Example ==


<pre>
<pre>
REM LOCALSTORAGE Save Example
Rem LocalStorage Save Example
localStorage.data = "This is Data."
localStorage.data = "This is Data."
(run and exit program)
(run and exit program)
REM LOCALSTORAGE Retrieve Example
Rem LocalStorage Retrieve Example
Print localStorage.data
Print localStorage.data
   
   
REM Test if Private Browsing is turned on
Rem Test if Private Browsing is turned on
Try
Try
   localStorage.private = "test"
   localStorage.private = "test"
Line 26: Line 26:
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 32: Line 32:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[sessionstorage|SESSIONSTORAGE]], [[sql|SQL]]
[[sessionstorage|SESSIONSTORAGE]], [[sql|SQL]]
[[Category:Language Reference]]

Revision as of 02:05, 17 August 2012

LocalStorage(string | variable)

Description

LocalStorage allows you to save string data so it is available next time you run the program. An entry can be created by assigning to LocalStorage.variableName, where variableName is chosen by you. Data is retrieved the same way. A program is allowed to store at least 5 megabytes of data in LocalStorage. The information in LocalStorage is lost if the browser cache is cleared. To be certain that you do not lose data, save it into an SQLite database instead.

LocalStorage is shared among all apps deployed from the same web server. This can be useful if you have a family of apps which need to share data.

Note that if the user has Private Browsing turned on, localStorage is not accessible.

Example

Rem LocalStorage Save Example
localStorage.data = "This is Data."
(run and exit program)
Rem LocalStorage Retrieve Example
Print localStorage.data
 
Rem Test if Private Browsing is turned on
Try
  localStorage.private = "test"
Catch err
   MsgBox "Please turn Private Browsing on"    
End Try

Output

This is the Data.    1

Related Items

SESSIONSTORAGE, SQL