2013-02-18 89 views
3

我想知道我怎么可以添加参数,以我的图片网址时,这个例子的Facebook动态消息对话框(直接URL)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参数,它工作正常。 关于这个的任何提示?

+0

我试图添加的URL是一个很长的Google Maps Static API URL。 – 2013-02-18 03:48:35

回答

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"; 

,因为我使用的是直接URL仅适用于移动设备的我也加入了display=touch

来源是here