Read dictionary-based data from local storage.
The key of the data to read.
Read dictionary-based data from local storage.
Visual Basic |
---|
Public Function ReadLocalStorage( _ ByVal Name As String _ ) As String |
The key of the data to read.
The value of the data to read.
For local storage to work you must handle the OnCreate event and set the following settings:
Option Explicit Private Sub Form_Resize() On Error Resume Next WebKitX.Move 0, 0, ScaleWidth, ScaleHeight Err.Clear End Sub Private Sub WebKitX_OnBrowserReady() ' For local storage to work, you need a URL WebKitX.Open App.Path + "\test.html" End Sub Private Sub WebKitX_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String) ' For local storage to work, you need the following settings Settings.cache_path = App.Path + "\Cache" Settings.user_data_path = App.Path + "\UserData" Settings.persist_user_preferences = 1 Settings.local_storage = True End Sub Private Sub WebKitX_OnLoadEnd() ' The eval() way WebKitX.Eval "window.localStorage.setItem('lastname', 'Smith');" MsgBox WebKitX.Eval("localStorage.lastname") ' The API way WebKitX.WriteLocalStorage "This is my variable !@$", "This is its value !!" + vbCrLf + "It has two lines!" MsgBox WebKitX.ReadLocalStorage("This is my variable !@$") End Sub