问题
I want to add a Facebook like button in my website.
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>
Why this is happening. Do I need to create a fb API for successful login?
回答1:
you must provide a valid url in order to work with the iframe method.
Anyway - you better use the xfmbl implementation of the like button
in order to do that you will have to open application (on http://developers.facebook.com/apps)
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>
add this namespace to your html
node:
<html xmlns:fb="http://ogp.me/ns/fb#">
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>
for any further information you may refer here: http://developers.facebook.com/docs/reference/plugins/like/
回答2:
The accepted answer is wrong.
You'll get the same error the OP described no matter what implementation you use. The issue is due to a bug on Facebook's side of things.
It's currently OPEN, ASSIGNED, and set to HIGH priority. See here for more details: http://developers.facebook.com/bugs/228506407275556
来源:https://stackoverflow.com/questions/11384215/facebook-like-button-an-error-occurred-with-facebook-platform-opt-in-please-tr