我是一个网站的PHP开发人员,最近用较新的代码示例替换了Sharer.php代码。Like按钮可以正常显示,但当您单击它时,弹出窗口只显示一两秒,然后消失。此外,弹出窗口中也没有显示描述--只有URL。Like按钮代码包含在用户可以隐藏的DIV容器中(使用JQuery),页面上有AJAX,可以每分钟自动查询表一次,以刷新屏幕上的计数器。
以下是一些代码片段,以备不时之需,任何帮助都将不胜感激:
<meta property="og:title" content="FourFreedomsBlog - Romney/Ryan: Channeling the inner McCain" />
<meta property="og:description" content="The Romney/Ryan campaign is evoking an eerie recollection of the McCain campaign of 2008: trust us - you'll get the details AFTER we're elected." />
<meta property="og:url" content="http://www.fourfreedomsblog.com/Blog.php?Act=ViewBlogPost&BlogID=2090" />
<meta property="og:image" content="http://www.FourFreedomsBlog.com/images/4Fv3.0.gif" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="FourFreedoms Blog" />
<meta property="fb:admins" content="14194340826" />
<div class="ShareThisContainer">
<div class="FoldingMenu">
<h4><button id="showShareThis" class="ButtonHide" /></button><span name="" id="">Share This!</span></h4>
<div id="SharePane" class="TogPane ItemHide">
<table class="ShareThis">
<tr>
<td colspan=8>
<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_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="http%3A%2F%2Fwww.FourFreedomsBlog.com%2FBlog.php?Act=ViewBlogPost&BlogID=2090" data-send="true" data-width="320" data-show-faces="true"></div>
</td>
</tr>
</table>
</div><!-- id=SharePane -->
</div><!-- class=FoldingMenu -->
</div><!-- class=ShareThisContainer -->发布于 2012-09-18 22:49:44
<div class="fb-like" data-href="http%3A%2F%2Fwww.FourFreedomsBlog.com%2FBlog.php?Act=ViewBlogPost&BlogID=2090" …
首先,不要在这里对data-href参数的值进行URL编码。
其次,不要在你的域名中使用大写字母- Facebook scraper在带有大写字母的域名上失败-比较
vs
最后,修复调试工具显示的错误:
对象无效值:类型为“”网站“”的URL“”http://www.fourfreedomsblog.com/Blog.php?Act=ViewBlogPost&BlogID=2090“”处的对象无效,因为无法将属性“”fb:admins“”的给定值“”14194340826“”分析为类型“”fbid“”。“”
14194340826是一个Facebook群组的id --但是群组不能是任何东西的“管理员”,只有普通的用户帐户可以。
https://stackoverflow.com/questions/12479153
复制相似问题