Is there a simple Facebook “Like” or share URL?

后端 未结 6 1834
一整个雨季
一整个雨季 2021-02-09 09:36

Is there a simple URL string that Facebook will accept to \"like\" a site... or more accurately (as a commenter points out below), share a site? As a comparison, Twitte

相关标签:
6条回答
  • 2021-02-09 09:45

    There is a way how to do it, but not very comfortable for users, because they must click on 'like' button twice.

    https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2F
    

    http%3A%2F%2Fexample.com%2F is url encoded version of http://example.com/ .

    Or you can place this link into iframe and then only one click is needed for liking of url

    0 讨论(0)
  • 2021-02-09 09:49

    Not exactly an answer, but close enough for me:

    http://www.facebook.com/sharer.php?u=http://mysite.com/
    

    That'll do it.

    0 讨论(0)
  • 2021-02-09 09:49

    No, Facebook only permits Liking a page via a Like button.

    0 讨论(0)
  • 2021-02-09 09:58

    There is a non-depreciated equivalent to the twitter or sharer.php functionality, though it is way more annoying. This doesn't exactly answer the question about "liking" a page but does accomplish the exact analogy to the twitter share, which seems to be what the question is asking.

    • https://developers.facebook.com/apps/ - make a new app with a developer account.
    • Make the Display Name the name of your business or website
    • add your domain without http under App Domains
    • add your base URL under Website with Facebook Login (with http )
    • Grab the App ID

    Now make your url like this:

    http://www.facebook.com/dialog/feed?app_id=000000000000000&link=http://example.com/whatever&redirect_uri=http://example.com/backtothesite

    You would think the redirect_uri would default to the user's facebook home or to the link parameter, but it's a required field.

    More parameters here: http://developers.facebook.com/docs/reference/dialogs/feed/

    0 讨论(0)
  • 2021-02-09 10:01

    It's a little more verbose with Facebook to do the same thing.

    <div id="fb-root"></div>
    <script>(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/all.js#xfbml=1&appId={YOUR_APP_ID}";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    
    <div class="fb-like" 
        data-href="http://mysite.com" 
        data-send="true" 
        data-width="450" 
        data-show-faces="true">
    </div>
    
    0 讨论(0)
  • 2021-02-09 10:04

    At the bottom of this page:

    http://developers.facebook.com/docs/share/

    Feel free to create your own implementation based on this.

    0 讨论(0)
提交回复
热议问题