該代碼對我來說看起來很好,但我不知道爲什麼它不會彈出FB彈出窗口並共享我的網站。爲什麼我無法在Facebook上分享我的網頁鏈接?
這裏是JS部分
function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: name,
caption: '',
description: (description),
href: hrefLink
},
action_links: [
{ text: hrefTitle, href: hrefLink }
],
user_prompt_message: userPrompt
},
function(response) {
});
}
function showStream(){
FB.api('/me', function(response) {
//console.log(response.id);
streamPublish(response.name, 'Connect with Abhishek Raj Simon on his new website http://abhisheksimion.cjb.net', 'hrefTitle', 'http://abhisheksimion.cjb.net', "Share abhisheksimion.cjb.net");
});
}
HTML
<a id="fbanchor" href="#" onclick="showStream(); return false;">Like it, Share it!</a>
有人能指出,我在哪裏去了?您可以訪問正在進行網站http://abhisheksimion.cjb.net
好奇,你有沒有考慮使用FBML?它支持共享,並且如果您將opengraph元標記添加到您的網站,Facebook將正確解析並顯示您關心的信息。 – Alan 2011-05-14 15:18:10
@Alan:謝謝,我來看看:) – abi1964 2011-05-14 15:20:38
@Alan:FB正在棄用FBML的過程中,請看這裏http://developers.facebook.com/docs/reference/fbml/任何其他的選擇? – abi1964 2011-05-14 15:25:56