Facebook客户聊天插件未显示

时间:2019-07-20 03:14:11

标签: facebook

我正在尝试在JSF项目中实现Facebook客户聊天插件(由facebook生成),但是当我插入代码片段时……我什么也没有得到,没有错误,没有聊天气泡,但是我可以看到生成的div及其数据

<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      xfbml            : true,
      version          : 'v3.3'
    });
  };

  (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 = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<!-- Your customer chat code -->
<div class="fb-customerchat"
  attribution="setup_tool"
  page_id="*********"
  theme_color="#44bec7"
  logged_in_greeting="Hello, speak with us"
  logged_out_greeting="Hello, speak with us">
</div>

应注意,由于JSF抛出错误attribution="setup_tool",我不得不为setup_tool添加双引号

1 个答案:

答案 0 :(得分:0)

添加

后即可正常工作
appId: '*****',
autoLogAppEvents : true

FB.init