代码之家  ›  专栏  ›  技术社区  ›  Matt Altepeter

社交媒体共享切断Hashtag

  •  0
  • Matt Altepeter  · 技术社区  · 11 年前

    我试图分享有一个框列表的页面,当你点击它时,它会显示该框的内容。当我点击图标分享时,比如在Facebook上,我看到它正确地获得了网址:

    https://www.facebook.com/sharer/sharer.php?u=http://localhost:50443/students/res-mock2.aspx#transferable-skills
    

    但真正被分享的链接是#可转移技能

    我使用encodeURI()对哈希标签进行编码。

    关于可能导致这种情况的原因,有什么建议吗?

    1 回复  |  直到 11 年前
        1
  •  1
  •   Bergi    11 年前

    我使用encodeURI()对哈希标签进行编码。

    这不会对哈希标签进行编码。使用 encodeURIComponent 而是:

    https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Flocalhost%3A50443%2Fstudents%2Fres-mock2.aspx%23transferable-skills