在 Facebook 应用程序的帖子中链接到本地​​主机上的图像时出现问题

发布于 2024-11-06 20:34:44 字数 916 浏览 3 评论 0原文

我使用以下代码在我刚刚启动的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖正好 2024-11-13 20:34:44

我也遇到了这个问题。我认为这是因为 Facebook 尝试获取图像,但无法访问本地主机。

I ran into this issue as well. I think it is because Facebook attempts to fetch the image, and cannot get to localhost.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文