【问题标题】:Can't share URL on social networks via their sharer无法通过共享者在社交网络上共享 URL
【发布时间】:2014-11-27 10:10:28
【问题描述】:

当我尝试通过 Facebook、Twitter 或 G+ 共享 URL 时,他们以错误的方式修剪 URL。 例如当我按下链接时:

  • “www.facebook.com/sharer.php?u=mysite.com/index.php?page=item&id=33140”
  • “twitter.com/share?url=mysite.com/index.php?page=item&id=33140”
  • "plus.google.com/share?url=mysite.com/index.php?page=item&id=33140"

他们都扔掉了最后一部分:“&id=33140”并尝试分享我网站上不存在的“mysite.com/index.php?page=item”页面。

如何强制他们处理整个 URL?

【问题讨论】:

  • 你真正的测试网址是什么?
  • 在 fb 调试器中看起来不错,但我没有找到任何 og 标签。

标签: facebook twitter google-plus share social-networking


【解决方案1】:

您必须对您的 URL 进行百分比编码,使其看起来像这样:http%3A%2F%2Fzabor.kg%2Findex.php%3Fpage%3Ditem%26id%3D33688

例如https://plus.google.com/share?url=http%3A%2F%2Fzabor.kg%2Findex.php%3Fpage%3Ditem%26id%3D33688

它起作用的原因是因为站点会将plus.google.com/share?url=mysite.com/index.php?page=item&id=33140 读取为具有url 的查询参数和id 的查询参数。因为& 未编码服务器认为它结束了url 参数而不是url 值的一部分。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多