Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8850887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:00:19+00:00 2026-06-14T13:00:19+00:00

I am using this Element on GWT to successfully add and display HTML code

  • 0

I am using this Element on GWT to successfully add and display HTML code on my web app.

However, when I try to add the “Facebook like button” code, it is not displayed at all:

Element adContainerDiv = getView().getFooter().getElement(); 
adContainerDiv.setInnerHTML("<div class='fb-like' data-href='http://www.example.com' data-send='false' data-layout='button_count' data-width='100' data-show-faces='false' data-action='recommend' data-font='arial'></div>");

This code is at the begining of the <body>:

    <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 = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=1265448483273";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <!-- END Facebook button function -->

Something similar happens with the “Tweet button” code, where a plain text link is displayed, without any style:

Element adContainerDiv = getView().getFooter().getElement();
adContainerDiv.setInnerHTML("<a href=\"https://twitter.com/share\" class=\"twitter-share-button\">Tweet</a>");

Right after the <body> I have this code (I tried as well on the setInnerHTML but still doesn’t work:

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

This is the way it looks in the DOM for the Tweet button between the <body></body>:

<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 = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=13592647473";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

<div style="top:0PX;height:60PX;width:1000PX;position: relative;" id="ur39jgf03kd">
<a href="https://twitter.com/share" class="twitter-share-button" 
data-via="example_com">Tweet</a></div>

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:00:20+00:00Added an answer on June 14, 2026 at 1:00 pm

    I doesn’t work for obvious reason – by default facebook/twitter buttons expects that all the buttons are created BEFORE the facebook/twitter script loads. So you should notify those external libraries after you created new buttons and attached them to the dom.

    Quick search for “Dynamically add twitter button using javascript” gives us the way how to do it for twitter:

    twttr.widgets.load();
    

    So we need to wrap this into native method into some your GWT classes (this is called JSNI):

      public static native void refreshTwitterButtons()/*-{
         $wnd.twttr.widgets.load();
      }-*/;
    

    What is left, is to call this function after you created and attached to DOM twitter button html code. For facebook at is basically the same workflow, you google “Dynamically add facebook button using javascript”, you find out which API you have to call, you create appropriate native method for it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code snippet to add KeyDown event handler to any element
Anybody know how to produce an xml element like this in rails using xml
I am using the foreignObject element in SVG, however IE9 does not support this
I'm using GWT and UiBinder for my app, and I'm trying to do this
I have some simple GWT client code that I would like to test using
I'm trying to rotate an SVG <polygon> (or any other element) using this: var
I'm using this codes for listing custom field values into drop-down list element on
I'm trying to parse a processing instruction like this using StAX: <?item something=<some_element></some_element>?> StAX
I am finding the selected jquery tab ui element using the following: $(li.ui-tabs-selected).attr(id) This
I'm working with Vaadin, a GWT like framework for developing rich web applications. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.