2011-08-26 43 views
0

我无法触发Like框中的edge.create事件。但是,它可以像普通的按钮一样工作。有限制吗?edge.create事件未在Like框中触发

这里是我的编码:

<html> 
    <head> 
    </head> 
    <body> 
     <div id="fb-root"></div> 
     <script src="http://connect.facebook.net/en_US/all.js"></script> 
     <script> 
      FB.init({ 
       appId : 'ID12456', 
       status : true, // check login status 
       cookie : true, // enable cookies to allow the server to access the session 
       xfbml : true // parse XFBML 
      }); 
     </script> 

     <p>Like Box:</p> 
     <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> 
     <fb:like-box href="http://www.facebook.com/apps/application.php?id=163685566990893" stream="false"></fb:like-box> 

     <br/><br/> 

     <script> 
      FB.Event.subscribe('edge.create', function(response) { 
       alert("Ok"); 
      }); 
     </script> 
    </body> 
</html> 

回答

0

马贝,因为你要链接你的Facebook JavaScript代码(all.js两次

我试过FB Rell上的代码,它正在工作。

<h1>Platform like-box Plugin with Defaults</h1> 
    <fb:like-box name="platform"></fb:like-box> 

    <script> 
     FB.Event.subscribe('edge.create', 
      function(response) { 
       alert('You liked the URL: ' + response); 
      } 
     ); 
    </script> 
+0

不,它仍然不能在独立的Html页面中工作。我删除了第二个all.js调用。任何其他想法?你有没有试过把它保存为html并测试它? – JOhn

+0

你能运行我上面发布的代码吗?只需将其复制到新的.html文件并输入应用程序ID即可。 - 它不适合我。 – JOhn

+0

是的,我试过了,它不工作。奇怪... – ChrisDelsart

0

是的这是一个已知的FB错误。见http://developers.facebook.com/bugs/378710432185222/

它似乎有时在某些情况下,而不是在其他情况下工作。一种解决方案是替换常规的按钮。如果您使用Facebook JS API和FQL调用,则可以访问所需的所有信息(页面名称,URL,方形图片)以重新创建类似的外观窗口小部件。不理想,但它的工作原理...