8000 Facebook Customer Chat issue with Turbolinks 5 on Rails · Issue #596 · turbolinks/turbolinks · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
Facebook Customer Chat issue with Turbolinks 5 on Rails #596
Open
@totycos

Description

@totycos

Every time I change pages, fb-root generates a new fb_dialog without removing the old one.
Here is my code:

application.js

// Load Facebook SDK for JavaScript 

function FBInit() {
  FB.init({
    appId      : '<XXXXXXXXXX',
    xfbml      : true,
    version    : 'v9.0'
  });
};

$(document).ready(function(){
  $.getScript( "https://connect.facebook.net/fr_FR/sdk/xfbml.customerchat.js", FBInit);
});

$(document).on('turbolinks:load', function(event){
  if (typeof FB !== "undefined" && FB !== null) {
    FB.XFBML.parse();
  }
});

$(document).on("turbolinks:before-cache", function() {
    $('[data-turbolinks-no-cache]').remove();
});

application.html.erb

<body> 
          <!-- Facebook Customer chat Plugin -->
          <div id="fb-root" data-turbolinks-permanent&
5352
gt;</div>

          <div class="fb-customerchat" data-turbolinks-no-cache attribution=setup_tool page_id="XXXXXXXXX"
            theme_color="#0A7CFF" greeting_dialog_display="hide" logged_in_greeting="Salut, tu peux me poser des questions et faire des remarques ici 🙂👇   "
            logged_out_greeting="Salut, tu peux me poser des questions et faire des remarques ici 🙂👇  ">
          </div>

Capture d’écran 2021-01-14 à 21 17 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0