2013-02-18 99 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