3

我想知道如何在此示例中向我的图片 URl 添加参数:

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

我尝试使用 %26 编码,但图片不显示。奇怪的是,当我在 redirect_uri 参数上尝试 %26 时,它工作正常。关于这个有什么建议吗??

4

1 回答 1

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,因为我只对移动设备使用直接 URL。

来源在这里

于 2013-02-21T07:01:47.090 回答