How to download facebook sdk asynchronous

I am using the following code to share on facebook.

<div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : "1549906631990069", status : true, cookie : true, xfbml : true, oauth: true, frictionlessRequests : true }); }; (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"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> 

After that, I have one image, when I click this image, a pop-up message from facebook will appear.

 <script type="text/javascript"> function shareOnFacebook() { var $temp = $(".wpProQuiz_points").find("span"); var scored = $temp.eq(2).text(); FB.ui( { method : 'feed', display : 'iframe', name : 'I have Scored '+ scored + ' in edumongoose quiz.', link : 'https://quiz.dev.edumongoose.com' }, function(response) { if (response && response.post_id) { alert('OK! User has published on Facebook.'); } else { alert('Post was not published.'); } } ); 

}

the work is good in the normal chrome and firefox window, but when I go into a private window, it displays by mistake: The resource in https://connect.facebook.net/en_US/all.js "was blocked because tracking protection was enabled.

What am I doing wrong?

+1
javascript php facebook wordpress
source share
1 answer

This is not your fault! The browser checks all downloaded script files for a list of scripts that are known to send tracking information back to the server. In incognito mode or in private mode, browsers typically block these scenarios for privacy reasons.

An error report was raised against Firefox at https://bugzilla.mozilla.org/show_bug.cgi?id=1226498

+3
source share

All Articles