duanlai1855 2016-10-27 08:20
浏览 167
已采纳

Facebook第一次分享时不显示缩略图[重复]

This question already has an answer here:

Tried many ways in this forum but it just work 80% .It mean when i clicked share button , it's work normally but sometime it still can't get the thumbnail image when i shared a post

Tried to set og:image in first page but it still not work . Mycode:

<meta property="og:image" content="http://www.example.com/a.jpg">
<meta property="og:image:secure_url" content="http://www.example.com/a.jpg">
<meta property="og:image:width" content="640">
<meta property="og:image:height" content="442">

Is there anyway to fix it? Thanks for reading

</div>
  • 写回答

2条回答 默认 最新

  • douwengzao5790 2016-10-27 08:36
    关注

    Add this in head section and change your app id and Image width and height should be same as og:image:width and og:image:height

    <meta property="fb:app_id" content=" your facebookAppId  " />
    <meta property="og:title" content=" This is title of post " />
    <meta property="og:url" content="http://www.example.com/a.jpg">
    <meta property="og:image" content="http://www.example.com/a.jpg" />
    <meta property="og:image:width" content="640" />
    <meta property="og:image:height" content="442" />
    <meta property="og:description" content=" This is description of post" />
    

    and also this code may help you

    <div id="fb-root"></div>
                            <script src="https://connect.facebook.net/en_US/all.js"></script>
    
    
         <script>
    /********* Code for deleting facebook cache ************/
                                    FB.api(
                                            '/',
                                            'POST',
                                            {"scrape": "true", "id": "http://www.example.com/a.jpg"}, 
                                            function (response) {
                                            }
                                    );
    /********* Code for deleting facebook cache ************/
    
                                (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.7&appId=xxxxxxxxxxfacebookAppId";
                                    fjs.parentNode.insertBefore(js, fjs);
                                }(document, 'script', 'facebook-jssdk'));</script>
                              <div class="fb-share-button" data-href="http://www.example.com/a.jpg" data-layout="button"></div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决