linking facebook share api to a button image
我不想使用默认的fb共享按钮,所以我创建了一个符合fb的按钮,并且漂亮的悬停,现在我想将它链接到fb共享api.is有可能做到这一点?
You can do that using the javascript sdk and the feed dialog. Just assign your image an onclick event and then call the dialog function. Below is the snippet from 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/70354.html