问题
Trying to integrate a facebook social like button plugin with the comment box. The like/unlike function works fine, and it reflects properly in my activity log on Facebook. However, once I type in a comment in the comment box and click "post to facebook", nothing happens! The comment box won't close when I submit, and it doesn't publish anything in the timeline.
I can see the post request in Firefox debugger. Facebook debugger doesn't report any errors on the page, and extracts the meta tags.
See my code below: What am I doing wrong or missing?
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta property="og:title" content="mytitle" />
<meta property="og:description" content="mydescription" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo $this->baseUrl(); ?>/welcome"/>
<meta property="og:image" content="<?php echo $this->baseUrl(); ?>/images/screen_shot_general.jpg" />
<meta property="og:site_name" content="myname" />
<meta property="fb:app_id" content="xxxxxxxxx" />
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxx', // App ID
channelUrl : '<?php echo $this->baseUrl(); ?>/channel.html', // 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>
<div class="fb-like" data-href="<?php echo $this->baseUrl(); ?>" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="lucida grande"></div>
回答1:
This is probably just a Facebook Plugin bug and it's not your code that's affecting the plugin, since it's loaded within an iframe. Are you still getting the issue? If you are, it's best to report the bug to Facebook or see if there is an existing bug that relates to the issue.
来源:https://stackoverflow.com/questions/14867127/facebook-like-button-comment-box-wont-close-on-submit-and-doesnt-post-anythin