Press enter to see results or esc to cancel.

Dynamic Facebook Share button for Website Webpages

In this video I am showing how to use dynamic share button in webpages. Normally it is done by pasting the URL in to the tools so it will generate the code for sharer automatically. Check the video below how to do that.

Create Facebook Share button for Website Webpages

But if you are going to copy paste the URL every time in every pages. Its hard to do. So I have coded to take URL of the page automatically and update it in the code so that each time you don’t need to do it manually.

This is basic HTML version. You can use the same method in all type of programming languages.

   function myFunction() {
   var x = document.URL;
   document.getElementById("jinu").src = ''+x+'&layout=button_count&size=large&mobile_iframe=true&width=83&height=28&appId';
 <body onload="myFunction()">
 <iframe id="jinu" src="" width="83" height="28" style="border:none;overflow:hidden" scrolling="no"  frameborder="0" allowTransparency="true"></iframe>


Leave a Comment