Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook共享缓存正在破坏,以在预览中查看指定的图像_Facebook_Facebook Graph Api_Caching_Header_Meta Tags - Fatal编程技术网

Facebook共享缓存正在破坏,以在预览中查看指定的图像

Facebook共享缓存正在破坏,以在预览中查看指定的图像,facebook,facebook-graph-api,caching,header,meta-tags,Facebook,Facebook Graph Api,Caching,Header,Meta Tags,我读过一些关于Facebook在你的页面上缓存结果的帖子,如果你输入URL并点击“获取新的抓取信息”,Facebook将刷新这个缓存 我已经将这个meta标签添加到了我的文档的正文中(因此不在),并且图像肯定存在,但是“共享”功能仍然在预览中显示随机图像 OpenGraph元标记是否需要位于中?我发现,是的,您需要将其插入中 我这样做: // inject the Facebook OpenGraph image into the header to allow the FB share fu

我读过一些关于Facebook在你的页面上缓存结果的帖子,如果你输入URL并点击“获取新的抓取信息”,Facebook将刷新这个缓存

我已经将这个meta标签添加到了我的文档的正文中(因此不在
),并且图像肯定存在,但是“共享”功能仍然在预览中显示随机图像


OpenGraph元标记是否需要位于
中?

我发现,是的,您需要将其插入

我这样做:

// inject the Facebook OpenGraph image into the header to allow the FB share functionality to pull in a more relevant image
var main_image = $('.main_image').attr('src');
if (main_image) {
    $('head').append("<meta property='og:image' content='" + main_image + "' />");
}
//将Facebook OpenGraph图像插入标题,以允许FB共享功能引入更相关的图像
var main_image=$('.main_image').attr('src');
if(主图像){
$('head')。追加(“”);
}