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?
javascript php facebook wordpress
John D. Doucette
source share