Logo

Navigation

  • Introduction
  • Structure
  • Environments
  • Setting up
  • How to …
  • References
    • Formula 1
    • Scripts
    • Configuration files
  • Legal
  • Credits

Related Topics

  • Documentation overview
    • References
      • Formula 1
        • Functions
          • Previous: Functions
          • Next: If role

Quick search

 
  • ← Functions
  • If role →

Get cookie¶

getCookie() is a function which makes consuming cookies a piece of cake. It returns the value of the cookie corresponding to name passed to it as parameter cname.

Signature¶

function getCookie(cname) {
    ...
    return value
}

Parameters¶

  1. cname

    Type

    string

    Default

    *required

    Description

    the name of the cookie whose value is being retrieved

Return¶

Type

string

Data
  • value of the cookie whose name is cname

  • null if the specified cookie is not found

Examples¶

import { getCookie } from 'formula_one'

Importing getCookie() from formula_one.

> getCookie('csrftoken')
'4OgZaiZcwEHAAeqnzqrn2jFubHe7IemgS07ZJJ0CltuQD3e0MSHIKaAtqeBb7HhD'

Using getCookie() to read the cookie named ‘csrftoken’.

 
  • ← Functions
  • If role →
©Information Management Group. | Page source
Fork me on GitHub