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
Html 如何从facebook sharer中排除图像_Html_Facebook - Fatal编程技术网

Html 如何从facebook sharer中排除图像

Html 如何从facebook sharer中排除图像,html,facebook,Html,Facebook,即使我在我的页面中使用这个meta,facebook sharer也会选择一个我用于ajax加载的图像(load.gif) 如何排除该图像?在需要显示该图像时,尝试使用Javascript将load.gif动态添加到页面中,而不是将其包含在HTML中。这样Facebook就不会在HTML中看到此图像。使用Leventix建议,我只能在主页上使用javascipt加载图像,以防止Facebook加载其他图像以“共享”主页上的图像。这就是我所做的 在头部,我明确说明了Facebook使用以下方式共享

即使我在我的页面中使用这个meta
,facebook sharer也会选择一个我用于ajax加载的图像(load.gif)


如何排除该图像?

在需要显示该图像时,尝试使用Javascript将load.gif动态添加到页面中,而不是将其包含在HTML中。这样Facebook就不会在HTML中看到此图像。

使用Leventix建议,我只能在主页上使用javascipt加载图像,以防止Facebook加载其他图像以“共享”主页上的图像。这就是我所做的

在头部,我明确说明了Facebook使用以下方式共享链接图像时要使用的图像:

<link rel="image_src" href="/images/site.gif" />

然后我加载的主页上所有对图像的引用如下:

<img alt="" onLoad="imgSrc(this, '<?php print base_path().path_to_theme() ?>/images/gall1.jpg');" src="/images/spacer.png" />

<script>function imgSrc(img, src) {if (img.src.search("spacer.png") > 0){img.src = src;}};</script>
/images/gall1.jpg');“src=“/images/spacer.png”/>
函数imgSrc(img,src){if(img.src.search(“spacer.png”)>0){img.src=src;}};

为了完整起见-这里是解决您问题的另一个解决方案: