Facebook 分享没有回应
facebook share not giving response
我知道有数百个与此相关的问题,大部分都有答案,但其中 none 似乎对我有用。
window.fbAsyncInit = function() {
FB.init({
appId : #{FbAppId},
xfbml : true,
version : 'v2.8'
});
};
$(document).on('click', '#share_dialog_open',function(){
var imageurl = $(this).attr('image_url');
var blog_description = $(this).attr('descr');
var blog_title = $(this).attr('blog_title');
var blogid = $(this).attr('blogid');
var vb_id = $(this).attr('vb_id');
FB.ui({
method: 'feed',
link: "http://URL/" + vb_id,
picture: imageurl,
description: blog_description,
title: blog_title
}, function(response){
console.log(response);
alert(response);
if(response && !response == undefined){
window.location="/congrats"
}
});
});
在 console.log 中我什么也没得到,在警报(响应)中我不断得到其中之一(未定义,[],[对象对象])
如有任何帮助,我们将不胜感激。
而且我也有 Omniauth.rb
provider :facebook, "#{FbAppId}", "#{FbAppSecret}", {:scope => 'email publish_actions email manage_pages publish_pages'}
致所有遇到新 API 问题并最终以某种方式来到这里寻找答案的人。这是我解决它的方法。
window.fbAsyncInit = function() {
FB.init({
appId : #{FbAppId},
xfbml : true,
version : 'v2.5' // don't_use_greater_version
});
};
FB.ui({
method: 'feed', // don't use share you won't get anything in response
link: "your_url_which_you_want_to_share,
picture: path_to_your_image,
description: your_description,
title: your_title
}, function(response){
console.log(response);
if (response == undefined || response == null) {
return
}
else if (response.length == 0 || !response.error_code) {
where_you_want_to_redirect
}
});
我知道有数百个与此相关的问题,大部分都有答案,但其中 none 似乎对我有用。
window.fbAsyncInit = function() {
FB.init({
appId : #{FbAppId},
xfbml : true,
version : 'v2.8'
});
};
$(document).on('click', '#share_dialog_open',function(){
var imageurl = $(this).attr('image_url');
var blog_description = $(this).attr('descr');
var blog_title = $(this).attr('blog_title');
var blogid = $(this).attr('blogid');
var vb_id = $(this).attr('vb_id');
FB.ui({
method: 'feed',
link: "http://URL/" + vb_id,
picture: imageurl,
description: blog_description,
title: blog_title
}, function(response){
console.log(response);
alert(response);
if(response && !response == undefined){
window.location="/congrats"
}
});
});
在 console.log 中我什么也没得到,在警报(响应)中我不断得到其中之一(未定义,[],[对象对象])
如有任何帮助,我们将不胜感激。
而且我也有 Omniauth.rb
provider :facebook, "#{FbAppId}", "#{FbAppSecret}", {:scope => 'email publish_actions email manage_pages publish_pages'}
致所有遇到新 API 问题并最终以某种方式来到这里寻找答案的人。这是我解决它的方法。
window.fbAsyncInit = function() {
FB.init({
appId : #{FbAppId},
xfbml : true,
version : 'v2.5' // don't_use_greater_version
});
};
FB.ui({
method: 'feed', // don't use share you won't get anything in response
link: "your_url_which_you_want_to_share,
picture: path_to_your_image,
description: your_description,
title: your_title
}, function(response){
console.log(response);
if (response == undefined || response == null) {
return
}
else if (response.length == 0 || !response.error_code) {
where_you_want_to_redirect
}
});