Skip to Content

readCookie()

Get data from a cookie.

JavaScript July 2, 2019

Usage

JavaScript
nebula.readCookie(name)

Parameters

name
(Required) (String) The name of the cookie
Default: None

Request or provide clarification »

Demo


Toggle cookie: OFF Last set on: (not set)


Source File

Located in /assets/js/nebula.js on line 4119.

JavaScript
nebula.readCookie = function(name){
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for ( var i = 0; i < ca.length; i++ ){
        var c = ca[i];
        while ( c.charAt(0) === ' ' ){
            c = c.substring(1, c.length);
        }
        if ( c.indexOf(nameEQ) === 0 ){
            return c.substring(nameEQ.length, c.length);
        }
    }
    return null;
};

Override

To override or disable this JavaScript function, simply redeclare it with the exact same function name.

JavaScript
nebula.readCookie = function(name){
    //Write your own code here, leave it blank, or return false.
}