How to Share on Facebook With JavaScript

A Facebook "Share" button on your website lets users share your pages with their Facebook friends. Facebook provides you with the code to add the button to your Web pages, so you do not need to create any advanced code. The button links to the Facebook network, but no private information is passed between your website and the Facebook user's account. The JavaScript button posts a link to the Facebook user's Wall, which helps you build traffic to the site.

Instructions

    • 1

      Right-click the Web page you want to use to display the share button. Click "Open With," then choose your HTML editor from the list of programs.

    • 2

      Add the JavaScript code to your header tags in the HTML page. Add the following code within the starting "<head>" tag and ending "</head>" tag in your code:

      <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
      type="text/javascript">
      </script>

    • 3

      Add the Facebook link in your content. The Facebook JavaScript function automatically displays the button to share your page. You just need to add the anchor tag to your content. Add the following code anywhere in your Web page content:

      <a name="fb_share"></a>

Related Searches:

References

Comments

Related Ads

Featured