Last active
August 23, 2016 12:55
-
-
Save baki250/87fa327396427dbe8070b0bcf8495532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read cookie | |
This function reads a cookie from the visitor's browser and returns the value. | |
Example Javascript | |
/* | |
* Usage | |
* This function will return the value of the cookie name passed in as the argument. | |
* | |
* @param {String} name - The name of the cookie. | |
*/ | |
var getCookie = function(name) { | |
var match = document.cookie.match(name+'=([^;]*)'); | |
return match ? match[1] : undefined; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment