在 Facebook 应用程序的帖子中链接到本地主机上的图像时出现问题
我使用以下代码在我刚刚启动的 Facebook 应用程序中发布到用户墙:
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'http://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://localhost:8888/project_images/110/110.png',
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.');
}
}
);
遗憾的是,即使当我输入: http://localhost:8888/project_images/110/110.png 进入我的浏览器,图像显示没有问题。另外,当我使用示例中的默认值时: http://fbrell.com/f8.jpg 作为图片:参数图像显示正常。这是因为本地主机而不起作用吗?我正在 MAMP 上运行 localhost。
I use the following code to publish to a users wall in my Facebook app I have just started:
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'http://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://localhost:8888/project_images/110/110.png',
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.');
}
}
);
Sadly this does not display the image eventhough when I enter: http://localhost:8888/project_images/110/110.png into my browser the image displays without an issue. Also, when I use the default from the example: http://fbrell.com/f8.jpg as the picture: parameter the image shows up fine. Is this not working because of the localhost? I am running localhost off MAMP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了这个问题。我认为这是因为 Facebook 尝试获取图像,但无法访问本地主机。
I ran into this issue as well. I think it is because Facebook attempts to fetch the image, and cannot get to localhost.