[英]Facebook “Recent Activity” from Asp.Net application
我正在开发一个带有FaceBook登录名的公共网站。 用户登录到Facebook后,我想将带有缩略图的网站URL发布到他的Facebook新闻源“已读:URL”
我是Facebook集成的新手。 我如何从asp.net应用程序实现此目的? 现在,我添加了两个iframe,例如“喜欢”和“近期活动”。 我可以看到我喜欢的帖子。 但是我该如何张贴我读取的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>
您正在寻找文章对象的“打开图操作”,特别是news.read操作。 您将需要设置一个集成此功能的应用程序。
您的每个页面都需要具有符合以下定义的article对象的meta标签:
<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);
}
});
}
在开放图谱教程中阅读更多内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.