我试图允许我的客户网站在Facebook上共享一个不同于该网站的URL。例如:http://www.example.com上有一个http://www.instagram.com的共享链接
每当我尝试时,我都会得到以下错误:
应用程序配置不允许给定URL :应用程序的设置不允许一个或多个给定URL。它必须匹配网站URL或画布URL,或者该域必须是应用程序的某个域的子域。
我不知道如何改变我的应用程序的设置,以允许共享一个不同的URL,虽然我猜这是可能的。
下面是我的代码片段,看看这是否有帮助:
// Facebook Share
$('#facebook-share').on('click', function(e){
e.preventDefault();
var url = $(this).attr('data-href');
FB.ui({
method: 'share',
href: url
}, function(response){
if (response) {
console.log('Facebook post published.');
} else {
console.log('Facebook post was not published.');
}
});
});发布于 2015-09-03 16:39:42
进一步的研究似乎表明,无论什么情况,Facebook应用程序只能与一个URL一起使用。我把事情改为使用sharer.php:
// Facebook Share
$('.facebook-share').on('click', function(e){
e.preventDefault();
var url = encodeURIComponent($(this).attr('data-href'));
var shareURL = "https://www.facebook.com/sharer/sharer.php?app_id=XXXXXXXX&sdk=joey&u="+url+"%2F&display=popup&ref=plugin&src=share_button";
var width = 655;
var height = 250;
var left = (screen.width/2)-(width/2);
var top = (screen.height/2)-(height/2);
window.open(shareURL, 'facebookShare', 'scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);
});https://stackoverflow.com/questions/32380251
复制相似问题