I am trying to use the facebook comments plugin.
I have this code, I have added after the opening <body>
tag and also tried before de closing </body>
like suggested here
<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/sdk.js#xfbml=1&appId=MY_APP_ID&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
And on the 'show' page I have
<div class="fb-comments" data-href="<%=request.original_url %>" data-numposts="5" data-colorscheme="light"></div>
The problem is that the plugin only shows when I refresh the page, not when I access the page through a link from the same site.
EDIT:
I discovered is has to do with turbolinks, I uninstalled it and it worked, I would like to find a solution with turbolinks installed. I tried this solution but couldn't make it work
I had same problem. You need to turn off your turbolinks. Go the link where people are using to access the page and turn it off there. For example:
<%= link_to 'Use', model, class: "btn btn-primary", :"data-no-turbolink" => true %>
:"data-no-turbolink" => true
will do this for you. It's a known problem when combining JS with Rails.