I've been using this code snippet:
function loadFacebook()
{
var app_id = $('meta[property="fb:app_id"]').attr("content");
$.ajax( {
type: 'GET',
url: '//connect.facebook.net/it_IT/all.js',
timeout: 2000,
dataType: 'script',
cache: true,
success:
function() {
FB.init({ appId: app_id, status: true, cookie: true, xfbml: true });
}
});
var pathname = $(location).attr('href');
$('#facebook-sharing').append('<div class="fb-share-button" data-href="'+pathname+'" data-width="140" data-type="button_count"></div>');
}
The caching doesn't seem to work and the page loading is extremely slow which is not the case for other websites I've seen.
Despite looking at similar questions, I haven't found a solution to my issue. Any help would be greatly appreciated. Thank you.