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>
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>
It might be not the OG protocol problem.
Even if your code is correct, facebook scrapper can't get your share images sometimes.
There are two ways to solve it. 1. Try to use facebook debugger to let the Crawler get your images properly. https://developers.facebook.com/tools/debug/