简体   繁体   English

来自Asp.Net应用程序的Facebook“近期活动”

[英]Facebook “Recent Activity” from Asp.Net application

I am developing a public website with a FaceBook login. 我正在开发一个带有FaceBook登录名的公共网站。 Once the user has logged in to the facebook, i want to post my website's URL with thumbnail to his facebook newsfeed "Has read : URL" 用户登录到Facebook后,我想将带有缩略图的网站URL发布到他的Facebook新闻源“已读:URL”

I am new to facebook integration. 我是Facebook集成的新手。 How can i achieve this from my asp.net application ? 我如何从asp.net应用程序实现此目的? Right now, i have added two iframes LIKE and Recent Activity. 现在,我添加了两个iframe,例如“喜欢”和“近期活动”。 I am able to see the post that i liked. 我可以看到我喜欢的帖子。 But how can i post the URL which is read by me ? 但是我该如何张贴我读取的URL? Thanks. 谢谢。

Note : For testing purpose i have used www.yahoo.com in the iframe. 注意:出于测试目的,我在iframe中使用了www.yahoo.com。

Below source code is taken from 下面的源代码摘自

http://www.abelski.com/courses/facebookplugins/abelski_facebook_plugins_page.html 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>

You are looking for an Open Graph Action specifically the news.read action for an article object. 您正在寻找文章对象的“打开图操作”,特别是news.read操作。 You will need to set up an application that integrates this. 您将需要设置一个集成此功能的应用程序。

Each of your pages will need to have the meta tags conforming to an article object as defined as 您的每个页面都需要具有符合以下定义的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>

And your action in JavaScript will need to be set up as 并且您在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);
           }
        });
  }

Read more at the Open Graph Tutorial 开放图谱教程中阅读更多内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM