Facebook API ~ how to publish to wallpost example, 發佈到塗鴉牆範例

這個是用Javascript發資訊到FB個人塗鴉牆的範例~~~

整個複製過去就可以了~~~~~~~記得要改一下API Key

------------------------------------------------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<!-- facebook connect -->
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : 1111111111111111111111111111111111',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});

// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};

(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- facebook connect -->
<script type="text/javascript">


function share(){
var publish = {
method: 'stream.publish',
message: 'getting educated about Facebook Connect',
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://bittyferrari.blogspot.com/',
media: [
{
type: 'image',
href: 'http://bittyferrari.blogspot.com/',
src: 'http://fbrell.com/f8.jpg'
}
]
},
action_links: [
{ text: 'fbrell', href: 'http://bittyferrari.blogspot.com/' }
],
user_prompt_message: 'Share your thoughts about RELL'
};

FB.ui(publish);
}
</script>
<button onclick="share()">share</button>
</body>
</html>

------------------------------------------------------------------------------------------------------------

reference
http://developers.facebook.com/tools/console/

沒有留言:

發佈留言