Facebook Share Story Image Does Not Appear For First time

前端 未结 2 475
旧巷少年郎
旧巷少年郎 2020-12-04 03:10

I try to share the article or web page but the story does not show the image when sharing for the first time but when i share for the next time, image is coming.

Che

相关标签:
2条回答
  • 2020-12-04 03:25

    UPDATE

    This solution with iframe is not working anymore! Worked since yesterday 06 February 2017. Facebook just set X-Frame-Options as DENY so you cannot load the sharer url in an iFrame. I'm figuring out another workaround.


    I struggled to find a solution for this facebook bug (adding og:image:width and og:image:height was not enough).

    Finally I came up with a workaround that worked: I added an hidden iFrame with the sharer link in the page footer; in this way the facebook crawler check the page once is loaded and, when you click facebbok share button in the first time you can see the shared image!

    Example:

    <iframe style="width: 0px; height: 0px; margin: 0px; padding: 0px;" src="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.example.com"></iframe>
    
    0 讨论(0)
  • 2020-12-04 03:26

    https://developers.facebook.com/docs/sharing/best-practices#precaching lists ways to avoid this problem, by either

    • scraping new articles upfront via API, or

    • specifying the image dimensions via OG meta tags as well.

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