在链接中分享自定义参数的脸书
facebook share for custom parameters in a link
我正在尝试使用此JavaScript函数在Facebook上共享我的自定义链接,
function postToFacebook(title, summary, image_url, U)
{
window.open('http://www.facebook.com/dialog/feed?app_id= ' + fb_app_id + '&display=popup&caption=' + title + '&description='+ summary + '&redirect_uri=' + encodeURIComponent('http://facebook.com') + '&link=' + encodeURI(U) + '&picture=' + image_url,'sharer','toolbar=0,status=0,width=548,height=325');
}
在我的"U"参数中,我有这个链接=>"http://localhost:4000/rings/solitaire-rings/lst?utf8=%E2%9C%93&min_price=&max_price=&name=solitaire-rings&category=rings&fashion_type=false&search=&gallery_order=&new_arrival=&best_seller=&metal_white=on&commit=APPLY"
当用户点击在Facebook上共享的链接时,用户应该被重定向到这个链接。 忘记根网址,即本地主机:4000,因为在生产环境中它考虑了所需的URL。
问题是我在Facebook用户上共享此URL的WHNE被重定向到"http://localhost:4000/rings/solitaire-rings/lst?utf8",并且它没有处理进一步的参数,即"%E2%9C%93&min_price=&max_price=&name=纸牌戒指&类别=戒指&fashion_type=false&搜索=&gallery_order=&new_arrival=&best_seller=&metal_white=on&commit=APPLY"
基本上我应该得到这个网址"http://admin.velvetcase.com/rings/lst?utf8=%E2%9C%93&min_price=&max_price=&name=rings&fashion_type=false&search=&gallery_order=&new_arrival=&best_seller=&search_material_id[]=Diamond&commit=APPLY",但是当我在Facebook上分享mu URL时,我得到了这个"http://admin.velvetcase.com/rings/lst?utf8=%E2%9C%93&%3Bmin_price&%3Bmax_price&%3Bname=rings&%3Bfashion_type=false&%3Bsearch&%3Bgallery_order&%3Bnew_arrival&%3Bbest_seller&%3Bsearch_material_id[0]=钻石&%3Bcommit=APPLY",这没有给出所需的输出。
这是我成功做到的
var sharingUrl = "https://www.facebook.com/dialog/feed?app_id="+ facebookAppID +
"&link=" + sharingUrl +
"&name=" + encodeURIComponent(title) +
"&caption=" + encodeURIComponent(caption) +
"&description=" + encodeURIComponent(content) +
"&picture=" + encodeURIComponent(thumb) +
"&redirect_uri=https://www.facebook.com";
window.open(sharingUrl);
对于我们需要使用encodeURIComponent
的所有参数,但我尽量不使用encodeURIComponent
进行sharingUrl
,它仍然有效!
- 如何让typeahead在我的搜索栏中填充自定义参数
- 如何将自定义参数传递到FullCalendar事件提要
- Worklight Client使用自定义BODY参数调用过程
- 评估作为参数传递给 Google 电子表格中自定义函数的条件
- 自定义共享网址Google+与多参数
- 如何自定义数据::confirm弹出窗口以提示输入,该输入将附加到请求参数中
- 从字符串中检索自定义参数的值
- 如何调用另一个js文件中的函数或触发一个自定义事件,该事件将参数作为Jquery中的数据对象传递
- extjs-使用传递的参数创建自定义函数
- 表单's自定义“;“多参数”;验证器并不总是启动
- 将角度工厂中的参数用于自定义标头
- PHP函数的自定义参数是如何在jquery中实现的
- 如何使用带有jQuery和自定义url参数的cookie
- 调用插件外部的自定义函数并传递参数
- 如何通过头中带有自定义参数的RestTemplate发送POST请求
- 我对javascript中的一个自定义函数感到困惑,该函数将对象作为参数获取
- 在应用脚本中,如何在自定义函数中包含可选参数
- 自定义数组函数不接受参数
- 自定义骨干路由参数
- 使用css样式和任意参数自定义console.log