2010-11-13 75 views
3

我試圖添加一個Facebook的按鈕到一個網站im工作,但沒有我添加的元屬性顯示出來。Facebook喜歡元問題

我在我的HTML以下(不包括不相關部分)

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:og="http://opengraphprotocol.org/schema/" 
     xmlns:fb="http://www.facebook.com/2008/fbml"> 

<head> 
... 
<meta property="og:site_name" content="My Site" /> 
<meta property="og:title" content="Some Product"/> 
... 
</head> 

<body> 
<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId : 'MYAPIKEY', 
     status : true, // check login status 
     cookie : true, // enable cookies to allow the server to access the session 
     xfbml : true // parse XFBML 
    }); 
    }; 

    (function() { 
    var e = document.createElement('script'); 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1'; 
    e.async = true; 
    document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 
... 
... 
<fb:like layout="button_count"></fb:like> 
... 

在什麼即時做錯了會非常讚賞任何指針。

+0

究竟發生了什麼?你在頁面上看到的結果是什麼? – 2010-11-13 18:30:37

回答

2

我意識到,問題是,我在我的本地計算機上測試機器。它開始工作,一旦我把網站在線。

0

相信Facebook頁面

http://developers.facebook.com/docs/guides/web

它應該是這樣的:

<iframe src="http://www.facebook.com/widgets/like.php?href=http://example.com" 
     scrolling="no" frameborder="0" 
     style="border:none; width:450px; height:80px"></iframe> 
+0

這就是如果您使用iframe。 – zsquare 2010-11-13 17:20:24

0

您遺漏了一些必要的開放圖形標籤。他們被定義爲here。至少你正在尋找 -

<meta property="og:title" content="Title of page"/> 
<meta property="og:type" content="CONTENT TYPE"/> 
<meta property="og:url" content="URL of PAGE"/> 
<meta property="og:image" content="URL of IMAGE"/> 
<meta property="og:site_name" content="SITE NAME"/> 
<meta property="fb:admins" content="USER_ID"/>