我的FB.ui运行良好,我可以分享我需要分享的任何信息。然而,问题是它正在被整合到ipad的网络应用程序中(这是"添加到主屏幕")。每当对话框打开时,它都是全屏打开的,一旦共享,就无法关闭打开的对话框。
<input type="button" onclick="share_prompt()" value="Share" />
function share_prompt()
{
FB.ui(
{
method: 'feed',
display: "iframe",
name: 'Facebook Dialogs',
link: 'http://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
message: 'Facebook Dialogs are easy!'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
我已经将"display"属性更改为所有可能的属性,但文档说它默认为网络应用程序中的"触摸"显示。
此外,更令人沮丧的是,在网络应用程序模式下,响应不会启动。仅在浏览器窗口中。
有什么想法吗?
这就是我解决这个问题的方法:
if(navigator.standalone){
new_url = 'https://www.facebook.com/dialog/feed?'+
'app_id=XXXXXXXXXXXXX'+
'&display=popup'+
'&caption='+fbName+
'&picture='+fbPicture+
'&description='+fbDescription+
'&link='+fbLink+
'&redirect_uri=http://myurl.com/mycontroller/#post_id';
window.open(new_url,'_self');
} else {
//do the normal way
}
通过这种方式,你可以有一个重定向url,如果你需要,你可以将帖子id发送回你的应用程序。如果你仍然没有找到解决问题的方法,希望这能回答你的问题。