Answers for "get all cookies from a site"

1

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);
Posted by: Guest on March-07-2020

Code answers related to "get all cookies from a site"

Code answers related to "Javascript"

Browse Popular Code Answers by Language