JavaScript for facebook

Hi !

I need to include that facebook comments plugin in one of the pages of my app.

Perfect! I went to facebook developer’s page and got the code to make things work.

The code is bellow and has 2 parts:

The 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); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

and the plugin to be put wherever I want the plugin to appear:

<div class="fb-comments" data-href="" data-num-posts="2" data-width="470"></div>

Ok, so I just created a CustomLayout and put the facebook code inside and then added the custom layout to the parent layout and voila… everything should work… I thought!

But things didn’t happen!

However I have added a button with a dummy code… doing nothing, and the facebook comments appears just after the button is clicked!
Ok, but I don’t want this button to show comments, the idea is that the comments appears direct in the page!

How can I solve this? Is it a bug? My vaadin version is 6.7.9 and I’ve tested both on firefox and chrome!

I appreciate any help, this is an urgent issue !

Here is my code:

final String script = "<div /><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); = id;"
				+ "js.src = \"//\";"
				+ "fjs.parentNode.insertBefore(js, fjs);"
				+ "}(document, 'script', 'facebook-jssdk'));</script>"
				+ "<div class=\"fb-comments\" data-href=\"\""
				+ " data-num-posts=\"2\" data-width=\"470\"></div>";


		CustomLayout fb = null ; 
		try {
			fb = new CustomLayout(new ByteArrayInputStream(script.getBytes()));
		} catch (IOException e) {
			// TODO Auto-generated catch block

		final Button alertMe2 = new Button("Show an alert using CustomLayout",new Button.ClickListener() {
			public void buttonClick(Button.ClickEvent event) {
				addComponent(new VerticalLayout());

Hi all…!!

After long time, just added fb.setHeight(“500px”); at line 23 and it worked!

I’ve also tried fb.setHeight(“100%”); unsuccessfully…

Anyway, the issue is solved!