我正在开发一个带有FaceBook登录的公共网站。一旦用户登录到Facebook,我想将我的网站带有缩略图的URL发布到他的facebook新闻源“已阅读:URL”
我是facebook整合新手。我如何从我的asp.net应用程序实现这一目标? 现在,我添加了两个iframe LIKE和Recent Activity。我能看到我喜欢的帖子。但是,我如何发布由我读取的URL?感谢。
注意:出于测试目的,我在iframe中使用了www.yahoo.com。
以下源代码来自
http://www.abelski.com/courses/facebookplugins/abelski_facebook_plugins_page.html
<iframe src="http://www.facebook.com/plugins/activity.php?site=sg.news.yahoo.com&width=300&height=300&header=true&colorscheme=light&font=arial&recommendations=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:300px;" allowTransparency="true"></iframe>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fsg.news.yahoo.com&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
答案 0 :(得分:1)
您正在寻找一个开放图表操作,特别是news.read对象的article操作。您需要设置一个集成此功能的应用程序。
每个页面都需要使元标记符合定义为
的文章对象<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#
article: http://ogp.me/ns/article#">
<meta property="fb:app_id" content="YOUR_APP_ID">
<meta property="og:type" content="article">
<meta property="og:url" content="URL of this object">
<meta property="og:site_name" content="Name of site hosting article">
<meta property="og:image" content="URL to an image">
<meta property="og:title" content="Name of article">
<meta property="og:description" content="Description of object">
<meta property="article:published_time" content="DateTime">
<meta property="article:modified_time" content="DateTime">
<meta property="article:expiration_time" content="DateTime">
<meta property="article:author" content="URL to Author object">
<meta property="article:section" content="Section of article">
<meta property="article:tag" content="Keyword">
</head>
<body>
<!-- main article body -->
</body>
</html>
您在JavaScript中的操作需要设置为
function postRead()
{
FB.api(
'/me/news.reads',
'post',
{ article: 'http://yoursite.com/articlepage.html' },
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Read was successful! Action ID: ' + response.id);
}
});
}
了解详情