cookie

Use cookies to set data in the user's browser that can persist between sessions. The cookie action allows for setting values into a cookie, and you can use a JavaScript function to retrieve the data back later.

Cookie values can also be retrieved in your FileMaker scripts. They are stored as a JSON object in the $$BF_State variable: JSONGetElement ( $$BF_State ; "params.handshake.headers.cookie" )

Options

To remove a cookie simply set the daysOrOptions value to 0

Examples

// action  object for 'cookie'
[
  {
    "action": "cookie",
    "options": {
      "action": "set",     // or get or remove
      "daysOrOptions": 1,
      "name": "MyCookieName",
      "value": "my cookie value"
    }
  }
]
// As JS function 
Vue.cookie.set('cookieName', 'some info here', 7);
Vue.cookie.getJSON('cookieName'); // returns JSON obj of cookie data

// Setting a cookie from a click within a HTML 
... @click="Vue.cookie.set('myCookieName', 4)" ...

There is no built-in custom function at this time. If you want to set a cookie from a FileMaker script, use the BF_SetAction_Function action with the functions above.

Cookies that you set in a browser are will persist for every page in your site (until they expire) and are sent with every hook script back to your FileMaker server. Be careful not to store too much data in cookies as this can impact your site's performance.

For more on reducing the payload that is sent to your FileMaker server, see this page.

Additional Reference:

This action is based on the following Vue modules:

Last updated