Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get all cookies

var getCookies = function(){
  var pairs = document.cookie.split(";");
  var cookies = {};
  for (var i=0; i<pairs.length; i++){
    var pair = pairs[i].split("=");
    cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('='));
  }
  return cookies;
}

var myCookies = getCookies();
console.log(myCookies);
Comment

get all cookies

let c = document.cookie.split(";").reduce( (ac, cv, i) => Object.assign(ac, {[cv.split('=')[0]]: cv.split('=')[1]}), {});

console.log(c);
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to edit a web page 
Javascript :: easiest way to show current date in react 
Javascript :: javascript get file extension 
Javascript :: regex check if number is even 
Javascript :: how to check variable type jquery 
Javascript :: js add space before capital letter 
Javascript :: jquery-3.6.0.min.js 
Javascript :: get the size of the browser jquery 
Javascript :: Source file requires different compiler version (current compiler is 0.8.4+commit.c7e474f2.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version 
Javascript :: location reload after 2 seconds 
Javascript :: how to add json data to xmlhttprequest 
Javascript :: js first letter uppercase 
Javascript :: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree 
Javascript :: style.visibility javascript 
Javascript :: set attribute checked jquery 
Javascript :: how to select the next element in js 
Javascript :: mysql json_extract remove quotes 
Javascript :: jquery check if checkbox is checked 
Javascript :: javascript urlencode json 
Javascript :: 1line uuid 
Javascript :: check ObjectId is valid in mongoose 
Javascript :: get children length jquery 
Javascript :: ready function jquery 
Javascript :: javascript random float 
Javascript :: javascript math.random from list 
Javascript :: Extract number from string javascripy 
Javascript :: javascript even mouseout 
Javascript :: warning ../../../package.json no license field 
Javascript :: javascript create element with attributes 
Javascript :: uppercase javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =