如何在asp.net中添加facebook评论框(3.5) [英] how to add facebook comment box in asp.net(3.5)

查看:72
本文介绍了如何在asp.net中添加facebook评论框(3.5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个应用程序,我想显示用户给出的评论我只是认为使用Facebook评论框但我没有得到如何在我的asp.net3.5中添加Facebook评论框我可以使用的步骤是什么?你的所有专家建议对我有用

iam creating one application where i want to show comment which user giving for that i just think use facebook comment box but iam not getting how can i add facebook comment box in my asp.net3.5 what is step i can use? your all expert advice is useful for me

推荐答案

Facebook评论框是一个由facebook提供的社交插件。为了实现这一点,您需要执行以下步骤: -



转到以下URL: -



https://developers.facebook.com/docs/plugins/comments





填写表格,然后点击名为获取代码的按钮。



单击此按钮将为您提供代码。复制该代码并将其粘贴到您的页面中。这通常也是一个可以分两步拆分的步骤: -



1)将javascript SDK粘贴到body标签的页面上。此代码如下: -



Facebook comments box is a social plugin provided by facebook. In order to implement that, you need to perform the following steps:-

Go to the following URL:-

https://developers.facebook.com/docs/plugins/comments


Fill the form, and click on the button named "Get Code".

Clicking on this button will give you a code. Copy that code and paste it in your page. This is also usually a step which can be broken in two steps:-

1) Paste the javascript SDK on your page in the body tag. This code is given below:-

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.3&appId=751348078240642";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>





第2步)。

在您想要显示评论框的位置添加以下代码: -





Step 2).
Add the following Code where you want comment box to appear:-

<div class="fb-comments" data-href="http://developers.facebook.com/docs/plugins/comments/" data-numposts="5" data-colorscheme="light"></div>





请注意以下事项: -



那里是在步骤2中粘贴的代码中的data-href属性。您需要将data-href的值替换为添加了注释框的页面的URL。



我在MVC View上给出了第2步的例子我在哪里使用了评论框。





Please Note following:-

There is an data-href attribute in the code which is pasted in step 2. You need to replace the value of data-href with the URL of the page where you have added comment box.

I am giving an example of Step 2 on MVC View where I have used the Comment box.

<div class="fb-comments" data-href="@Request.Url.ToString()" data-numposts="5" data-colorscheme="light"></div>





你可以看到我在运行时用实际的U替换了data-href属性的值页面的RL。



You can see that I have replaced the value of the data-href attribute at run time with the actual URL of the page.


我得到了自己的答案:)



i got my own answer :)



< script>(function(d,s,id){

var js,fjs = d.getElementsByTagName(s)[0];

if(d.getElementById(id))return;

js = d.createElement(s); js.id = id;

js.src =// connect.facebook.net/en_US/all.js#xfbml=1;

fjs.parentNode。 insertBefore(js,fjs);

}(文档,'script','facebook-jssdk'));< / script>

粘贴在body中的代码




<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
paste above code within body



只要你想要


paste this code whenever u want



这篇关于如何在asp.net中添加facebook评论框(3.5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆