我们可以从 Facebook 分享对话框中得到回拨回复吗
can we get call a back response from facebook share dialogue box
Facebook分享对话框能得到回调响应吗?
我创建了一个自定义分享按钮并试图从那里获得响应。
但是它在共享对话框中也给了我单击取消按钮的成功响应
<script>
window.fbAsyncInit = function(){
FB.init({
appId: '782351051797017', status: true, cookie: true, xfbml: true });
};
(function(d, debug){var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];if (d.getElementById(id)) {return;}js = d.createElement('script'); js.id = id; js.async = true;js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";ref.parentNode.insertBefore(js, ref);}(document, /*debug*/ false));
function postToFeed(title, desc, url, image){
var obj = {
method: 'feed',
link: url,
picture: 'http://www.url.com/images/'+image,
name: title,
description: desc
};
function callback(response){
console.log('test');
}
FB.ui(obj, callback);
}
</script>
<a href="" data-image="article-1.jpg" data-title="Article Title" data-desc="Some description for this article" id="btnShare">Share</a>
<script>
$('#btnShare').click(function(){
elem = $(this);
postToFeed(elem.data('title'), elem.data('desc'), elem.prop('href'), elem.data('image'));
return false;
});
</script>
得到解决方案,我只需要阅读回复
function callback(response){
if(response==null){
console.log('test1');
}
else{
console.log('test2');
}
}
FB.ui(obj, callback);
Facebook分享对话框能得到回调响应吗?
我创建了一个自定义分享按钮并试图从那里获得响应。 但是它在共享对话框中也给了我单击取消按钮的成功响应
<script>
window.fbAsyncInit = function(){
FB.init({
appId: '782351051797017', status: true, cookie: true, xfbml: true });
};
(function(d, debug){var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];if (d.getElementById(id)) {return;}js = d.createElement('script'); js.id = id; js.async = true;js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";ref.parentNode.insertBefore(js, ref);}(document, /*debug*/ false));
function postToFeed(title, desc, url, image){
var obj = {
method: 'feed',
link: url,
picture: 'http://www.url.com/images/'+image,
name: title,
description: desc
};
function callback(response){
console.log('test');
}
FB.ui(obj, callback);
}
</script>
<a href="" data-image="article-1.jpg" data-title="Article Title" data-desc="Some description for this article" id="btnShare">Share</a>
<script>
$('#btnShare').click(function(){
elem = $(this);
postToFeed(elem.data('title'), elem.data('desc'), elem.prop('href'), elem.data('image'));
return false;
});
</script>
得到解决方案,我只需要阅读回复
function callback(response){
if(response==null){
console.log('test1');
}
else{
console.log('test2');
}
}
FB.ui(obj, callback);