Facebook like button:Facebook Platform Opt In发生错误。请稍后再试 [英] facebook like button: An error occurred with Facebook Platform Opt In. Please try again later
问题描述
我想在我的网站上添加一个像Facebook的按钮。
I want to add a Facebook like button in my website.
如果我使用以下代码,如按钮正在工作,但是登录错误消息:Facebook Platform Opt In发生错误,请稍后再试显示。
If I use the following code like button is working but on log in the error message : "An error occurred with Facebook Platform Opt In. Please try again later" is displayed.
<html>
<head>
<title>My Great Web page</title>
</head>
<body>
<iframe src="http://www.facebook.com/plugins/like.php?href=guiuiu"
scrolling="no" frameborder="0"
style="border:none; width:450px; height:80px"></iframe>
</body>
</html>
为什么会发生这种情况。我需要创建一个成功登录的fb API?
Why this is happening. Do I need to create a fb API for successful login?
推荐答案
您必须提供一个有效的URL才能使用iframe方法。
you must provide a valid url in order to work with the iframe method.
无论如何 - 您最好使用相似按钮的xfmbl实现
Anyway - you better use the xfmbl implementation of the like button
为了做到这一点将不得不打开应用程序(在 http://developers.facebook.com/apps )
in order to do that you will have to open application (on http://developers.facebook.com/apps)
然后将该代码粘贴到您的页面的< body>
标签之后(放置其所在的APP ID)
then paste this code after the <body>
tag of your page (put the APP ID where it belongs)
<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&appId=APP_ID_GOES_HERE";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
将此命名空间添加到您的 html
节点:
add this namespace to your html
node:
<html xmlns:fb="http://ogp.me/ns/fb#">
,而不是您使用的iframe
and put this instead of the iframe you used
<fb:like send="false" href="YOUR_PAGE_ABSOLUTE_URL" width="450" show_faces="true"></fb:like>
有关您可以参考的任何进一步信息:
http://developers.facebook.com/docs/reference/plugins/like/
for any further information you may refer here: http://developers.facebook.com/docs/reference/plugins/like/
这篇关于Facebook like button:Facebook Platform Opt In发生错误。请稍后再试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!