Skip to content

Instantly share code, notes, and snippets.

@gouravtiwari
Created March 7, 2019 22:58
Show Gist options
  • Save gouravtiwari/730b5d1e81eafd3185420cc91f9312fb to your computer and use it in GitHub Desktop.
Save gouravtiwari/730b5d1e81eafd3185420cc91f9312fb to your computer and use it in GitHub Desktop.
Add multiple cookies from string
var str = "a=b; c=d;";
var addCookies(str) {
var multiple = res.split(";");
for(var i=0; i<multiple.length; i++) {
var key = multiple[i].split("=");
document.cookie=key[0] + "=" + key[1];
}
};
addCookies(str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment