Search code examples
javascriptjqueryfacebookfacebook-like

facebook like and share button javascript updating my web page content like reloading a page


Hello Everyone i am stuck here. can't find out why this is happening. facebook like and share button javascript updating my web page content like reloading a page.

(function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) return;
              js = d.createElement(s); js.id = id;
              js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=";
              fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk')); 

this script i am using in my site.

HTML CODE

<div class="fb-like" data-href=" https://www.facebook.com/example" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true" data-colorscheme="light"></div>

Solution

  • Adding data-height="20px" data-width="48px" to the button code fixed the issue for me.