Skip to content

Instantly share code, notes, and snippets.

@gurdiga
Last active February 25, 2016 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gurdiga/2fe83fbaa1a1a2db67c6 to your computer and use it in GitHub Desktop.
Save gurdiga/2fe83fbaa1a1a2db67c6 to your computer and use it in GitHub Desktop.
A little function to get a cookie by name. Useful to debug from the the browser console.
function getCookieByName(name) {
return unescape(
(document.cookie.split(/; /g)||[])
.filter(function(pair) {
return pair.split('=')[0] === name;
})[0]
.split('=')[1]
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment