Dynamic Facebook Like Button

Dynamic Facebook like button that allows the webmaster/developer to post this set of code on each page, and each will have a dynamic like button that when pressed likes the specific page. Dynamic Facebook Like Button Code for people trying to set up a dynamic facebook like button on their webpages. This code enables the webmaster to post one set of code on each page, with the address dynamically created.

Javascript Dynamic Facebook Like Button Code


<script language=”JavaScript”> document.write(“<iframe src=\”http:\/\/www.facebook.com\/plugins\/like.php? href=”+document.URL+”&layout=button_count&show_faces=false&width=80&action=like&font=verdana&colorscheme=light\” scrolling=\”no\” frameborder=\”0\” style=\”border:none; overflow:hidden; width:80px; height:22px\” allowTransparency=\”true\”><\/iframe>”); </script>

It is worth noting that this code was not created by me, and is working as of the 1st of June 2011. Sometimes, unfortunately, the host sites change and the code doesnt work. I recently had a problem with my dynamic tweet button when Twitter changed, hopefully Facebook will be more stable. when I remember where I got it from I will place a link in the references.


I have recently changed the way I use social media on my site by including an ‘addthis’ applet. I recommend that most webmasters use this services because it is far simpler. How it works is that you put the “addthis” code in and it simply generates all the buttons you need as per the buttons at the base of this article. Follow the following link to create an AddThis account and get the code for your website: AddThis

Related posts: