Skip to content

Instantly share code, notes, and snippets.

View wsatchmo's full-sized avatar

Will S wsatchmo

View GitHub Profile
@wsatchmo
wsatchmo / cookies.js
Created November 14, 2019 20:38
Basic Cookie Function
// NOTE: In order to modify cookies, we must access them over a secure connection e.i = https, localhost:.
// Needed to create this function to readCookies. Essentially it splits up the cookie list
// See the working app at http://cookie-example-rcb.herokuapp.com/ or by opening with Firefox or Safari
function readCookie(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) {