3

只有当人们喜欢我的 Facebook 页面时,我才会尝试在我的网站上显示内容。不幸的是,我无法让它工作......我使用 edge.create 和 edge.remove 但即使我“喜欢”页面,它也会通过“edge.remove”函数而不是“edge.create”函数...

这是我的代码:

<!DOCTYPE html>

<html lang="fr" xmlns:fb="http://ogp.me/ns/fb#">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">     
        <meta name="DC.Language" content="fr" />
        <meta name="DC.Creator" content="Noomia" />
        <meta name="keywords" content="" />
        <meta name="description" content="" />          
    <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

    <link rel="stylesheet" type="text/css" href="./css/screen.css" media="screen" />
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>

    <script src="./js/scripts.js" type="text/javascript" charset="utf-8"></script>
    <title>Concours LTBR</title>  

</head>

<body>
    <div id="fb-root"></div>
    <script>
    window.fbAsyncInit = function() {
        FB.init({
          appId      : '118439091595657', // App ID
          channelUrl : 'http://cedriccharles.be-webdesigners.com/concoursLTBR/index.html', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          xfbml      : true  // parse XFBML
        });


        FB.Event.subscribe('edge.create', function(href) {
            alert('Like');
         });
        FB.Event.subscribe('edge.remove', function(href) {
            alert('Unlike');    
        });
    };
    // Load the SDK Asynchronously
      (function(d){
         var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/fr_FR/all.js";
         ref.parentNode.insertBefore(js, ref);
       }(document));
</script>


    <div id="main">
    <fb:like href="https://www.facebook.com/pages/Noomia-studio/100473956669259" send="false" width="960" show_faces="true"></fb:like>
    </div>
</body>

4

0 回答 0