1

我在 MVC4 中创建了一个新的测试项目来测试我是否可以使用来自 Nuget 库的 Facebook Helper。我按照非常简单的说明进行操作,点击从 Nuget 安装 Facebook 帮助程序,编辑您的页面,然后插入点赞按钮。

当我运行该项目时,我实际上可以看到当我通过 firebug 查看它时正在生成 facebook likebutton,但它没有出现在页面上。

这是我的默认索引页面

@{
    ViewBag.Title = "Home Page";
}
@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
                <h2>@ViewBag.Message</h2>
            </hgroup>
            <p>
                To learn more about ASP.NET MVC visit
                <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
                The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET MVC.
                If you have any questions about ASP.NET MVC visit
                <a href="http://forums.asp.net/1146.aspx/1?MVC" title="ASP.NET MVC Forum">our forums</a>.
            </p>
        </div>
    </section>
}
<h3>We suggest the following:</h3>
<div>
    @Facebook.LikeButton()
</div>

我已经浏览了几个关于 Facebook 助手的页面,它们都以相同的方式描述了这个过程。有谁知道在使用这个库之前我是否应该配置任何文件?

编辑:

我将粘贴执行后加载到标记中的 html 代码。我会缩写一些脚本和东西,因为它有数百行代码:)

<html id="facebook" class="" lang="en">
<head>
<meta charset="utf-8">
<script>
<script>
<noscript><meta http-equiv="refresh" content="0; URL=/plugins/like.php?href=http%3A%2F%2Flocalhost%3A13876%2F&amp;layout=standard&amp;show_faces=src&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80&amp;font&amp;locale=en_US&amp;ref&amp;_fb_noscript=1" /></noscript>
<meta content="noodp, noydir" name="robots">
<meta id="meta_referrer" content="default" name="referrer">
<meta content="Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet." name="description">
<link href="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Flocalhost%3A13876%2F&layout=standard&show_faces=src&width=450&action=like&colorscheme=light&height=80&font&locale=en_US&ref" media="handheld" rel="alternate">
<title>Facebook</title>
<link href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yc/r/-WUN6qLbp5n.css" rel="stylesheet">
<link href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yf/r/gd49XKRAMNQ.css" rel="stylesheet">
<link href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yc/r/XaOowWd9_Aq.css" rel="stylesheet">
<link href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yH/r/Dpn1SKTH3-z.css" rel="stylesheet">
<script src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yB/r/Vm1JnKckidu.js">
<script src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y-/r/ARN_8tuLdws.js">
<script src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yq/r/XboiPeV3jQI.js">
<script>
<script>
<script src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yP/r/eTzqwp1jxjF.js" async="">
<script src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yh/r/aTzvHAZI_Jd.js" async="">
</head>
<body class="plugin ff4 win Locale_en_US">
<div id="FB_HiddenContainer" style="position:absolute; top:-10000px; width:0px; height:0px;"></div>
<script>
<script>
<script>
</body>
</html>
4

2 回答 2

2

查看它在 URL 中生成的位置 (link href="https://www.facebook...) 它说 "&show_faces=src" 这会导致问题;它应该是 "&show_faces=true"

即使 true 应该是默认值,如果您遇到此问题,请尝试将其更改为: @Facebook.LikeButton(showFaces: false)

编辑:这仅在您将其设置为 false 时才有帮助。LikeBox 和所有布尔属性的问题相同。

于 2013-05-29T18:33:55.423 回答
0

如果 HTML 正在呈现,我只能假设问题是 CSS 问题,检查 FireBug 中元素的样式并确保它们没有被隐藏,例如检查display: nonevisibility: hidden确保没有float应用哪个正在使用它离开屏幕。

于 2013-01-23T13:07:38.060 回答