我想知道如何在这个例子中向我的图片 URl 添加参数:
我尝试使用 %26 编码,但没有显示图片。 奇怪的是,当我在 redirect_uri 参数上尝试 %26 时,它工作正常。 关于这个的任何提示??
最佳答案
您需要正确编码所有部分(下面的示例 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。
来源是here .
关于facebook - 无法在 Facebook 提要对话框(直接 URL)上添加带有 url 参数的图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14927619/