Created
June 10, 2012 22:58
-
-
Save underdown/2907596 to your computer and use it in GitHub Desktop.
Set Cookie On Like/unlike (FBML)
This file contains hidden or 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
| <script> | |
| function SetCookie(cookieName,cookieValue,nDays) { | |
| var today = new Date(); | |
| var expire = new Date(); | |
| if (nDays==null || nDays==0) nDays=1; | |
| expire.setTime(today.getTime() + 3600000*24*nDays); | |
| document.cookie = cookieName+"="+escape(cookieValue) | |
| + ";expires="+expire.toGMTString(); | |
| }; | |
| FB.Event.subscribe('edge.create', function(response) { | |
| SetCookie("liked",1,365) | |
| }); | |
| FB.Event.subscribe('edge.remove', function(response) { | |
| SetCookie("liked",0,365) | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment