Skip to content

Instantly share code, notes, and snippets.

@crova
Last active July 9, 2018 19:25
Show Gist options
  • Save crova/9a39d38f9ce42e283621d530ad10ef6d to your computer and use it in GitHub Desktop.
Save crova/9a39d38f9ce42e283621d530ad10ef6d to your computer and use it in GitHub Desktop.
how to get info pro cookie
<script>
document.cookie;
function getCookie(Munchmothafuckincookies) {
var s1 = s1 + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(s1) == 0) {
return c.substring(s1.length, c.length);
}
}
return "";
}
function checkCookie() {
var s1 = getCookie("s1");
if (s1 != "") {
var href = $("a[href*='#s1#']").attr("href");
href = href.replace(/#s1#/g,getURLParameter("s1"));
$("a[href*='#s1#']").attr("href",href);
} else {
s1 = prompt("Please enter your name:", "");
if (s1 != "" && s1 != null) {
setCookie("username", s1, 365);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment