- ELB Learning Knowledge Base
- Actions and Variables
- Quick Win Tutorials
- Getting Started
- Modular Development (ModDev)
- Quick Guides
- Best Practices
- Navigating the Workplace
- Building a Title
- Importing Content
- Working With Text
- Working with Images
- Working With Objects
- Actions and Variables
- Tests, Surveys, and Questions
- Working with Web Windows or HTML Extensions
- Publishing a Title
- Creating Web-based, Accessible Content (Section 508/WCAG)
- Lectora Layouts
- Managing Titles
- Managing your Assignments
- Managing Your Notifications
- Admin Guide
- Lectora Player Skins
- Lectora Interactions and Scenarios
- Using Tracking for Progress, Status, etc
- Working with BranchTrack
- Trouble Shooting
- Working with Audio and Video
The Training Arcade®
Rockstar Learning Platform
Can't find the answer? Ask our Customer Solutions team.
How do I save a value in a cookie in the user's browser to be accessed in another session?
You can use a Lectora variable to store a value as a cookie in the user's browser. This value can then be accessed in a future session by this same user.
If you want to save a value as a cookie in a user's browser, the Lectora variable feature can be used. Here are the steps to use a Lectora variable to save the value as a cookie.
- Create a user variable in the Variable manager. Click on Tools, then Variables to open the Lectora Variable Manager.
- Click on the Add button in the lower left of the Variable Manager window.
- Enter a unique name in the Variable Name field
- Set an initial value if you want one
- Choose the check box next to "Retain variable value between sessions.
- Click the OK button midway down the page to save this variable.
- Click the Close button to close the Variable Manager window
- You can use a Lectora action to add data to this variable.
- Modify Variable Set Equal To will save the data in the Action Value field to the variable.
- Modify Variable Add to Variable will append the data in the Action Value field to the variable
- When you want to access the data in the variable, you use the VAR(variableName) function, where "variableName" is replaced by the name of the variable you created in section 1 above.
This functionality will work in "Preview in a browser", and when you publish to HTML and use the Preview button to test the saving of the data in the browser cookie.