Cookie Manager — Reference
Read and write browser-visible cookies through App Connect.
Read and write browser-visible cookies through App Connect.
Before you begin
Section titled “Before you begin”- An App Connect page with the State Management component included. Use a dedicated test key for experiments.
Cookie Manager
Section titled “Cookie Manager”Read and write browser-visible cookies through App Connect.
Properties, data and actions
Section titled “Properties, data and actions”| Part | Meaning |
|---|---|
| ID | The component name used in expressions, for example cookieState. |
| Define Cookies | Declares cookie names/schema for the editor’s pickers. It does not create a cookie. Set the page App ID before defining this metadata. |
| Values | Read a value through cookieState.data.name, such as cookieState.data.wappler_docs_preference. Values are decoded strings; they are not automatically converted to booleans or objects. |
| Set: Name / Value | Writes the selected cookie name and a string representation of the supplied value. |
| Set: Expires | Optional expiration. The runtime accepts a date value or numeric day count. A numeric 7 means seven days; a string is parsed as a date instead. Omission creates a session cookie rather than guaranteeing persistence after the browser closes. |
| Path | Cookie path scope, default /. Use the same scope when removing the cookie. |
| Domain | Optional cookie domain. Omit it for the current response/document host unless a deliberate domain scope is required. |
| Secure | Adds the secure cookie flag when enabled; test on HTTPS. |
| Remove | Expires the selected cookie with the supplied path/domain options. It cannot remove an HTTP-only cookie through client JavaScript. |
| Remove All | Intended to remove visible cookie keys for the supplied scope. In the installed State Management 2.0.1 implementation its callback lacks the component receiver and can throw. Use individual Remove actions for known keys rather than assuming this operation succeeded. |
Worked example
Section titled “Worked example”Name the component cookieState. Define wappler_docs_preference for the picker, then call its Set action with value compact. Bind text to cookieState.data.wappler_docs_preference and confirm compact. Remove the same key with Path / and confirm it disappears. For a code-level expression, cookieState.set(‘wappler_docs_preference’, ‘compact’, {expires: 7, path: ’/’}) supplies a numeric seven-day expiry.
Lifetime and boundaries
Section titled “Lifetime and boundaries”Browser-visible cookies can be read by client code and may be sent with matching requests. They are not a secure identity or permission store. The component refreshes its data snapshot through its own operations; do not assume a server or another script changing a cookie instantly refreshes every manager instance.
Choose the right storage
Section titled “Choose the right storage”Compare URL, cookie, session and local state before choosing where application data belongs. Browser state never replaces server-side access checks.
Check your result
Section titled “Check your result”You can use the correct data path, configure a value and verify the storage/removal scope.