0

嗨,我想使用 fb 共享器对多个项目进行页面共享。但据我了解,我需要将描述标题放在元标记上。但是如果我希望它是动态的呢?例如,我单击一个项目,然后基于我单击的项目,fb 共享器弹出窗口将出现并显示我单击的项目的详细信息。这甚至可能吗?现在下面是我的代码

<meta property="og:url"           content="{{ $data['url'] }}" />
<meta property="og:type"          content="{{ $data['type'] }}" />
<meta property="og:title"         content="{{ $data['title'] }}" />
<meta property="og:description"   content="{{ $data['description'] }}" />
<meta property="og:image"         content="{{ $data['image'] }}" />
<meta property="og:image:width"   content="640" />
<meta property="og:image:height"  content="442" />

这是我的 javacript 代码

var fbShare = function(url, description, winWidth, winHeight) {
    var winTop = (screen.height / 2) - (winHeight / 2);
    var winLeft = (screen.width / 2) - (winWidth / 2);

    // Try to remove the meta and replace it but its not working
    $('meta[property="og:description"]').remove();
    $('head').append( '<meta property="og:description" content="Testing">' );

    window.open('http://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url),
        'ListShare',
        'top=' + winTop +
        ',left=' + winLeft +
        ',toolbar=0,status=0,width='+ winWidth +
        ',height='+ winHeight);
}

另外我没有任何 FB ID,所以我认为我不能为此使用 FB.ui。或者是否可以在没有 appid 的情况下使用 FB.UI,因为从他们的网站上说它是必需的这里

4

0 回答 0