How to update facebook open graph image

Say if you have set the facebook image for your webpage via the meta tag of the open graph protocol like this: <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>

If you want to replace/update the image with another image of the same name rock.jpg, how do you get facebook to update your image accordingly with the new image when you share the page? Forcing facebook to fetch your page's data with this link http://developers.facebook.com/tools/debug won't update the image.

Answers


this is the most consistent answer I've found to this problem: https://stackoverflow.com/a/21468084/339698

If you're too lazy to go to that link, you can POST an ajax request with the url you are trying to clear:

$.post(
    'https://graph.facebook.com',
    {
        id: 'http://www.site.com/my/share/url/',
        scrape: true
    },
    function(response){
        console.log(response);
    }
);

Facebook stores your image into their own image on their servers, and then caches it for 24h. The cache delay might change in the future, so to check it just open the image that facebook creates from your image and check its "max-age" value in the http headers. So if you change your image, facebook will not update its version until 24h even if you use this link http://developers.facebook.com/tools/debug to force the data fetching.

To solve this, if you need to see the effect of your change right away you should rename your image. So if the old version was rock.jpg name it rock2.jpg then use this link http://developers.facebook.com/tools/debug to get facebook to create a new image from your updated image. This will update immediately your webpage's facebook image in the facebook share.


if you are using any cache plugin, make sure you clear all your caches. Also make sure the image you are using has the recommended facebook size: 1200(w) x 630(h) or 600 x 315.


Need Your Help

Javascript on ASP.NET Master page not running on content page in subdirectory

javascript jquery asp.net

I have some jQuery events on a Master page, which needs to run on all of the content pages. If the content page is in the same directory as the master page, it works fine. However, if the content ...

Splitting ASCII text files in C

c file split fopen

Suppose I have the following code in C: