将facebook共享API链接到按钮图像
我不想使用默认的fb共享按钮,所以我创建了一个符合fb的按钮,并且漂亮的悬停,现在我想将它链接到fb共享api.is有可能做到这一点?
您可以使用javascript sdk和提要对话框来实现这一点。 只需将图像分配一个onclick事件,然后调用对话框功能即可。 以下是https://developers.facebook.com/docs/reference/dialogs/feed/中的摘录
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
链接地址: http://www.djcxy.com/p/70353.html