Andres Espinosa
Andres Espinosa

Reputation: 402

Facebook Messenger Customer Chat Plugin on mobile website

I'm trying to insert Custom Chat plugin on my website. It works perfectly but it does not look good on mobile. I just want it to have the page width, but it looks like this:

enter image description here

Here's my HTML code, it's really simple:

<!DOCTYPE html>
<html>
  <head>
    <title>Otto Bot</title>
  </head>
  <body>
    <!-- Load Facebook SDK for JavaScript -->
    <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 = 'https://connect.facebook.net/es_LA/sdk/xfbml.customerchat.js#xfbml=1&version=v2.12&autoLogAppEvents=1';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>

    <!-- Your customer chat code -->
    <div 
      class="fb-customerchat" 
      attribution="setup_tool" 
      page_id="<MY-PAGE-ID>" 
      logged_in_greeting="Hablemos?" 
      logged_out_greeting="Hablemos?"
      minimized='false'>
    </div>
  </body>
</html>

I just copied and pasted the code given in my page settings. I've already tried with the instructions given in https://developers.facebook.com/docs/messenger-platform/reference/web-plugins/#customer_chat

Upvotes: 0

Views: 4821

Answers (1)

Andres Espinosa
Andres Espinosa

Reputation: 402

Just had to add a viewport meta tag in the head section:

<!DOCTYPE html>
<html>
  <head>
    <title>Otto Bot</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <!-- Load Facebook SDK for JavaScript -->
    <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 = 'https://connect.facebook.net/es_LA/sdk/xfbml.customerchat.js#xfbml=1&version=v2.12&autoLogAppEvents=1';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>

    <!-- Your customer chat code -->
    <div 
      class="fb-customerchat" 
      attribution="setup_tool" 
      page_id="<MY-PAGE-ID>" 
      logged_in_greeting="Hablemos?" 
      logged_out_greeting="Hablemos?"
      minimized='false'>
    </div>
  </body>
</html>

Upvotes: 2

Related Questions