我在过去一年中已经在4个网站上安装了Facebook赞/发送按钮(使用异步javascript),但我注意到发送按钮不再有效(尽管在安装时进行了测试)。
例如#1:http://www.libbiking.com/
在相关页面上我添加了:
<meta property="og:title" content="Libbi King" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.libbiking.com/" />
<meta property="og:image" content="http://www.libbiking.com/mygallery/site/img/www_libbiking_com_facebook_01.gif" />
<meta property="og:site_name" content="Libbi King" />
<meta property="fb:admins" content="618598922" />
<meta property="fb:app_id" content="251724341605334" />
<meta property="og:description" content="Illustrator & Set Designer in London | libbi@libbiking.com | tel: 07706 553 288" />
和
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '251724341605334', // App ID
channelUrl : '//www.libbiking.com/mygallery/site/libbiking/fb_channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// 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/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<fb:like href="http://www.libbiking.com/" send="true" layout="button_count" width="180" show_faces="false" font="segoe ui"></fb:like>
使用fb_channel.php:
<?php
$cache_expire = 60*60*24*365;
header("Pragma: public");
header("Cache-Control: max-age=".$cache_expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
?>
<script src="//connect.facebook.net/en_US/all.js"></script>
奇怪的是,它现在向Facebook页面(而不是网站)显示安全的https URI。发送时会返回错误消息:
'发送邮件时遇到以下错误:无法访问https://www.facebook.com/pages/Libbi-King/355311097871934页面,因为服务器返回状态代码200'
我通过Facebook Linter / Debugger&amp; amp;使用响应代码200,OG看起来很好。我不确定为什么会导致错误,因为我理解响应代码200是一个成功的页面检索。如果我用不正确的URI替换按钮href,发送按钮实际上有效!
我注意到,在注册App时,类型描述最近已从“网站”更改为“使用Facebook登录的网站”。我不知道这是否会引起这个问题......