Share text on Facebook

Asked

Viewed 680 times

2

I’m trying to share the text of my web to Facebook, I’m using the Addthis to create social media buttons. He gives me this:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
    <a class="addthis_button_preferred_1" addthis:url="http://www.planow.com.br/jrgrill/dicas.php?id='.$id.'" style="width:29px"></a>
    <a class="addthis_button_preferred_2"style="width:29px"></a>
    <a class="addthis_button_preferred_4"style="width:29px"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5329d2273cb2c738"></script>
<!-- AddThis Button END -->

I’m trying to pass the content by parameters, but I can’t. How should I proceed?

  • Try using the browser’s Network tool and see how the aqruivo request is doing s7.addthis.com/js***

2 answers

5


To pass parameters or even set a specific URL, you have three ways to do it:

  • Enter the parameter for the Addthis in wrapper:

    <div class="addthis_toolbox addthis_default_style addthis_32x32_style"
         addthis:url="http://www.planow.com.br/jrgrill/dicas.php?id=1">
        <!-- ... -->
    </div>
    

    You had added the parameter to the link, but it must be in div containing the links.

  • In the settings, you indicate the desired URL:

    <script type="text/javascript">
      var addthis_config = {
        url: "http://www.planow.com.br/jrgrill/dicas.php?id=1"
      };
    </script>
    
  • You use the setAttribute() to define the attribute addthis:url with the URL you want to use:

    <div class="addthis_toolbox addthis_default_style addthis_32x32_style" id="minhaWrapper">
      <!-- ... -->
    </div>
    <script type="text/javascript">
      var addThisWrapper = document.getElementById("minhaWrapper");
      var meuURL = "http://www.planow.com.br/jrgrill/dicas.php?id=1";
      addThisWrapper.setAttribute("addthis:url", meuURL);
    </script>
    

Any such method may be used to indicate to the Addthis which URL and its parameters we intend to use.


Link to the Addthis documentation for Setting the URL to Share (English).

-1

An alternative is the quote plugin that allows people to select texts on their page and attach them to their shares, to tell a more interesting story. To use this plugin it is not necessary to implement the Facebook login or request other permissions through the application review.

https://developers.facebook.com/docs/plugins/quote#Try

Quote Plugin

Browser other questions tagged

You are not signed in. Login or sign up in order to post.