无法在Facebook Feed对话框中添加带有url参数的图片(直接URL)

时间:2013-02-18 00:02:38

标签: facebook url parameters dialog feed

我想知道如何在这个例子中为我的图片URl添加参数:

https://www.facebook.com/dialog/feed?app_id=...&link=...&picture=www.blablabladotcom?parameter1=1&parameter2=2&name=...&caption=...&description=...&redirect_uri= ...

我尝试使用%26编码并且图片没有显示出来。 奇怪的是,当我在redirect_uri参数上尝试%26时,它运行正常。 关于这一个的任何提示??

1 个答案:

答案 0 :(得分:0)

您需要正确编码所有部件(例如下面的Java脚本代码):

var _FBAPPID = "xxxxxxxxxx", // your app ID (mandatory)
    _name = "name",
    _text = "text",
    _link = "link",
    _picture = "http://cdn2.insidermonkey.com/blog/wp-content/uploads/2012/10/facebook4-e1349213205149.jpg", // some google image - replace it
    _caption = "caption",
    _redirect_uri = "http://google.com" // this URL must be from within the domain you specified in your app's settings

var _params = "&name=" + encodeURIComponent(_name)
    + "&description=" + encodeURIComponent(_text)
    + "&link=" + encodeURIComponent(_link)
    + "&picture=" + encodeURIComponent(_picture)
    + "&caption=" + encodeURIComponent(_caption)
    + "&redirect_uri=" + encodeURIComponent(_redirect_uri);

var _href = "http://www.facebook.com/dialog/feed?app_id=" + _FBAPPID + _params + "&display=touch";

我还添加了display=touch,因为我只在移动设备上使用直接网址。

来源为here