我正在尝试向我正在处理的网站添加一个类似 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>
...
任何关于我做错了什么的指示将不胜感激。
最佳答案
我意识到,问题是我正在本地计算机上测试机器。当我将网站上线后,它就开始工作了。
关于Facebook 之类的元问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4173247/