代码之家  ›  专栏  ›  技术社区  ›  cracker

LinkedIn共享在I.E 9和8中无法正常工作

  •  0
  • cracker  · 技术社区  · 11 年前

    我正在使用LinkedIn共享来共享数据:

    http://www.linkedin.com/shareArticle?mini=true&url={articleUrl}&title={articleTitle}&summary={articleSummary}&source={articleSource}
    

    它工作得很好,除了不了解问题所在。

    DEMO 这在所有浏览器中都能正常工作,但在即浏览器中无法正常工作。

    感谢任何帮助。

    1 回复  |  直到 6 年前
        1
  •  2
  •   Alvaro Montoro    11 年前

    问题不在于代码本身或IE,而是生成的链接包含了一个让Internet Explorer疯狂的奇怪字符:(我很惊讶它对其他人有效)。

    因此,您生成的链接是:

    https://www.linkedin.com/shareArticle?mini=true&url=www.romans.co.uk%2fRomansImages%2fCMS%2fNewsInsights%2fNews%2fMarraways201410071155325608.jpg&title=A%20September%20to%20remember;%20Romans %20秒%20最大%20拍卖%20销售%20本%20年&summary=与%20the%20joy%20of%20an%20Indian%20summer%20spreading%20through%20the#20packed%20sales%20room,%20Roman%20September%20auction%20&source=www.romans.co.uk%2fRomansImages%2fCMS%2fNewsInsights%2fNews%2fMarraways201410071155325608.jpg

    (注意,在那个有趣的角色之后,连SO都打破了它)

    替换/删除该字符,一切正常:

    https://www.linkedin.com/shareArticle?mini=true&url=www.romans.co.uk%2fRomansImages%2fCMS%2fNewsInsights%2fNews%2fMarraways201410071155325608.jpg&title=A%20September%20to%20remember;%20Romans%20second%20largest%20auction%20sale%20this%20year&summary=With%20the%20joys%20of%20an%20Indian%20summer%20spreading%20through%20the%20packed%20sales%20room,%20Romans%20September%20auction%20&source=www.romans.co.uk%2fRomansImages%2fCMS%2fNewsInsights%2fNews%2fMarraways201410071155325608.jpg

    解析并编码URL,使其不包含奇怪的字符,并且可以在所有浏览器中使用。