I am currently working on integrating Facebook UI Dialogs into my website.
My goal is to add custom actions when users share a post from my site.
I have created my app, added the app URL and domain (which is the same as the URL), and included all necessary code on my site. However, when I click the share button, it shows an error:
Can't load URL: The domain of this URL is not listed in the app's domains. To fix this, you need to add all domains and subdomains of your app to the App Domains field in your app settings.
This is the code I've been using:
<script type="text/javascript">
$(function(){
// initialize fb sdk
window.fbAsyncInit = function() {
FB.init({
appId : 'appid',
xfbml : true,
version : 'v2.8'
});
};
(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/es_LA/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});
function share_property(){
FB.ui({
method: 'feed',
link: 'link',
}, function(response){});
}
</script>
And here is the HTML for the share button:
<div class="query-submit-button pull-right">
<input id="shareBtn" type="button" value="Compartir" onclick="share_property();">
</div>