Reputation: 399
I'm integrating FB sdk to my website, I'm use FB.UI to init share dialog, but it was blocked by browser, there is anyway to display popup share dialog, here is my code:
$.ajax({
type: "POST",
url: urlApi,
data: json
}).done(function (data) {
var obj = jQuery.parseJSON(data);
var resp = jQuery.parseJSON(data);
if (resp.success == "1") {
var option = { method: 'feed', link: resp.link, title: resp.title, caption: resp.url, name:resp.title, display: "popup" };
FB.ui(option);
}
});
Note: I can not user DIRECT URL share dialog, because I need data response from FB so I use javascript api.
Upvotes: 0
Views: 639
Reputation: 3815
Browsers will block popup windows if they are not spawned by the result of a direct user click. In your example, FB.ui is being called on success of an ajax call (not a direct user class click). Without providing more of your code, or context, all I can suggest is that you will need to rethink your architecture in order to achieve your ajax call and then FB share dialog.
Upvotes: 1