Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook like button not showing in webview (ios and android)

I have a simple application that runs an html file in a webview. When I run it in android browser or in iphone browser safari, I'm able to see the facebook like button.

But when it comes to the webviews in both platforms the like button doesn't show.

my html file

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

my javascript file

this.getItems().items[0].setHtml('<div class="fb-like" data-href="http://test.com" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true"></div>');
like image 635
john Avatar asked Oct 09 '22 01:10

john


1 Answers

Resolved when i added https: to //connect.facebook.net/en_US/all.js#xfbml=1

like image 103
john Avatar answered Oct 12 '22 19:10

john