I’m currently trying to figure how I can implement the Facebook Share API on my application. I have been getting errors even though I have implemented it correctly. Here is so far what I’ve done. I have copied the following code below from the Facebook Application that I have just created and placed it on the Web Application that I’m currently building.
window.fbAsyncInit = function() {
FB.init({
appId : 'APP ID',
xfbml : true,
version : 'v2.9'
});
FB.AppEvents.logPageView();
};
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$('#facebook').on('click', function() {
// FB.ui({
// method: 'feed',
// link: 'http://localhost/es/',
// caption: 'An example caption',
// }, function(response){});
FB.ui({
method: 'share',
display: 'popup',
quote: 'test',
href: 'http://nytimes.com/'
}, function(response){});
})
I tried testing it and right now I got this error.
This is the web application that I’m currently developing and is running on Python/Angular.
I made a separate page on my localhost using XAMPP and also using the same Facebook Code for testing. And to my surprise it works.
If you look at the settings on my Facebook Application. I did not have to add the url in App Domains
and also Site URL
in order for it work (Look at the second image). I tried placing the IP address of my Web App but it won’t allow it. I even disabled the pop-up blocker that is installed on my browser