开发者

how to exclude an image from facebook sharer

even though i use this meta <link rel="image_src" href="myimage"/> in my page, facebook sharer selects an image开发者_如何学JAVA that i am using for ajax loading (load.gif)

how can i exclude that image ?


Instead of including it in the HTML, try adding that load.gif to the page dynamically using Javascript when you need to display it. This way Facebook will not see this image in the HTML.


Using Leventix suggestion, only on the home page I had to use javascipt to load images to prevent facebook from loading other images for "sharing" images found on the home page. Here's what I did.

In the head, I explicitately stated the image that is to be used when Facebook share link images apear using:

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

And then all references to images on the home page I loaded like this:

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜