Facebook分享了一个带照片的页面

时间:2012-10-19 13:01:51

标签: c# javascript jquery asp.net facebook

当我点击“分享”时,它会在新标签页中打开Facebook分享页面。我想在这个页面的左栏显示temp.jpg。怎么做?

Test.aspx文件

<div id="page-wrap">
<!-- AnythingSlider #1 -->
<ul id="slider1" style="width: 778px; height: 452px; background:#fff;">
    <li>
        <div style="float: left; padding-right: 35px; padding-left:50px;">
            <img src="../../img/temp.jpg" style="width: 264px;
                height: 377px; border: none;" />      
            <uc:DownloadControl ID="DownloadControl1" runat="server" PageParameters="1" />
        </div>                
    </li>
    <li>
    <uc:DownloadControl ID="DownloadControl2" runat="server" PageParameters="2" />

...

DownloadControl.ascx

<div style="float: left">
<a class="icerik" id="facebookShare" runat="server" target="_blank">
<img border="0" src="images/facebook.jpg" alt="Resorts"
    title="Hotels & Resortss" /> Share </a>

DownloadControl.ascx.cs

protected void Page_Load(object sender, EventArgs e)
 {    
 facebookShare.HRef = "http://www.facebook.com/sharer.php?u=http://www.test.com/test.aspx";
 }

1 个答案:

答案 0 :(得分:0)

如果要在与 sharer.php 共享时添加有关页面的自定义信息,则必须在页面顶部放置其他开放图形元标记。对于此示例,test.com/test.aspx包含以下标记:

<head>
<meta property="og:title" content="Test" />
<meta property="og:url" content="http://www.test.com/test.aspx" />
<meta property="og:image" content="http://www.test.com/img/temp.jpg" />
// other meta tags
</head>

有关Open Graph协议的更多信息是here