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
https://www.youtube.com/watch?v=6W-JR0yFyX4

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.
Share.html

<html>
 <head>
  <script>
   function myFunction() {
   var x = document.URL;
   document.getElementById("jinu").src = 'https://www.facebook.com/plugins/share_button.php?href='+x+'&layout=button_count&size=large&mobile_iframe=true&width=83&height=28&appId';
  }
  </script>
</head>
 <body onload="myFunction()">
 <iframe id="jinu" src="" width="83" height="28" style="border:none;overflow:hidden" scrolling="no"  frameborder="0" allowTransparency="true"></iframe>
 </body>
</html>

Comments

Leave a Comment