Skip to content

Instantly share code, notes, and snippets.

@whichlight
Created July 13, 2012 04:27
Show Gist options
  • Save whichlight/3102715 to your computer and use it in GitHub Desktop.
Save whichlight/3102715 to your computer and use it in GitHub Desktop.
client side programmatic "liking" on facebook
/*
This code will click like's currently loaded
on a facebook page. It's likely in the future
the name of the classes may change.
Be careful though, if you do too many at once
you'll get a warning.
To use this copy and paste it to your browser's
javascript console, or add javascript: to the
beginning and paste it all in your browser address bar.
disclaimer: this is not intended for actual use,
and only educational purposes.
*/
var A = document.getElementsByClassName("like_link stat_elem as_link");
var B = document.getElementsByClassName("stat_elem as_link cmnt_like_link");
var a = [];
for(i in A){a.push(A[i])};
for(i in B){a.push(B[i])};
for(i in a){if(a[i].title=="Like this item"){a[i].click();}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment