How to imbed facebook messenger to xojo web page?

I am exploring to add facebook messenger to xojo web page. Facebook provided script as show below:

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

    (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 Chat Plugin code -->
  <div class="fb-customerchat"
    attribution=setup_tool
    page_id="xxxxxxxx">
  </div>

How and where can I paste it?

@ronaldo_florendo, You can try the

WebHTMLViewer1.LoadHTML("<html><body>paste your code here</h1></body></html>")

method of loading code into a html viewer.

Looking at the FB code you will likely need to edit the page_id.

You have a few different solutions see http://documentation.xojo.com/topics/user_interface/web/controls/html_viewer.html

Kind regards, Andrew

1 Like

I believed there is no “LoadHTML” method within WebHTMLViewer1

WebHTMLViewer got a LoadHTML method in 2020r1
http://documentation.xojo.com/api/user_interface/web/webhtmlviewer.html#webhtmlviewer-loadhtml

@ronaldo_florendo

If using Xojo Web before 2020 R1 use HTMLViewer1.LoadPage instead of the newer HTMLViewer.LoadHTML (the example usage is the same).

If you are using a version prior to 2020 R1, you can view the HTMLViewer1.LoadPage documentation by setting ‘When seeking help’ = Use built-in documentation, in Xojo Preferences.