开发者

Facebook Share button parameters don't work properly?

开发者 https://www.devze.com 2023-04-11 01:33 出处:网络
I use this API: http://developers.facebook.com/docs/share/ At the bottom of the page they have mentioned a way to create our own button.

I use this API: http://developers.facebook.com/docs/share/ At the bottom of the page they have mentioned a way to create our own button.

So my code is like this:

<body>
    <?php    
    function encodeURIComponent($str) {
      $revert = array('%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')');
      return strtr(rawurlencode($str), $revert);
    }
    ?>

    <a href="ht开发者_如何学Pythontp://www.facebook.com/sharer.php?u=<?php echo encodeURIComponent('http://www.google.com'); ?>&t=<?php echo encodeURIComponent('It is the google website'); ?>">Share this2</a>

  </body>

But it is not working properly! And it always displays the page title as the title in the share dialog!


See How does Facebook Sharer select Images? answer from OffBySome can explain better then I.


An excerpt from some of the better answers:

In the head section of your HTML you need meta tags:

<meta property="og:title" content="title" />
<meta property="og:description" content="description" />
<meta property="og:image" content="thumbnail_image" />

You may need to force Facebook servers to clear the cache with the Facebook Url Debugger.

0

精彩评论

暂无评论...
验证码 换一张
取 消