使用开放图表无法使用facebook按钮

时间:2011-12-07 21:11:05

标签: facebook facebook-like facebook-opengraph

我正在尝试使用Facebook开放图来自定义我的发送和喜欢显示,但它不起作用,我不知道为什么。

这是header.php中的标题:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">

<!-- Head =================================================================================================-->

<head>
    <title>AskSanta - <?php echo $title; ?></title>

    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="author" content="" />
    <meta name="distribution" content="global" />
    <meta name="copyright" content="Copyright &copy; 2011 by JustAskSanta. All rights reserved." />
    <meta name="description" content="Content to be written here" />        
    <meta name="keywords" content="Keywords to be written here" />
    <meta property="og:title" content="Ask Santa Online" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="http://www.justanswersanta.com" />
    <meta property="og:image" content="http://www.justanswersanta.com/images/santa.png" />
    <meta property="og:site_name" content="Ask Santa Online" />
    <meta property="og:description" content="Hey kids (or kids at heart)! Want to ask Santa a question? Brought to you from the North Pole by JustAnswer."/>

这是thankyou.php中的like按钮;

<?php include("header.php"); ?>

<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://www.justanswersanta.com" data-send="true" data-layout="button_count" data-show-faces="false" data-font="lucida grande"></div>

这是输出:

http://www.justanswersanta.com/thankyou.php

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您的代码和OG标记似乎是正确的。 我认为你的页面已经被Facebook用早期版本缓存了。 Facebook有一个对象调试工具,通过此工具,您可以刷新缓存的页面信息:http://developers.facebook.com/tools/debug

我使用this link探索了您的网页。通过这种方式,我刷新了您的页面缓存。现在,您的网站正在被正确废弃。请检查一下。