【发布时间】:2019-03-18 11:16:15
【问题描述】:
我在我的 ReactJS 应用程序中使用 LinkedIn 的以下共享插件:
<script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://www.linkedin.com"></script>
来自 LinkedIn 文档:https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/plugins/share-plugin
它在 Chrome/Firefox/Safari 上运行良好。但是,单击 LinkedIn 共享按钮(由上述脚本生成)时,会出现 LinkedIn 共享弹出窗口,我在应用程序控制台中收到错误消息:
[object Error]: {description: "[Messenger] 必需属性 'target' 未提供”,消息:“[Messenger] 必需属性 'target' 未提供”,nr@seenError:真,堆栈:“错误:[Messenger] 匿名函数未提供必需的属性“目标” (https://platform.linkedin.com/xdoor/scripts/in.js:7:55143) 在 Array.prototype.forEach (native code) at t (https://platform.linkedin.com/xdoor/scripts/in.js:7:54936) 在电子 (https://platform.linkedin.com/xdoor/scripts/in.js:7:56462) 在电子 (https://platform.linkedin.com/xdoor/scripts/in.js:7:34661) 价值 (https://platform.linkedin.com/xdoor/scripts/in.js:18:23834) 在 s (https://platform.linkedin.com/xdoor/scripts/in.js:18:38221) 在 nrWrapper ([MY_SITE_LINK_ADDRESS]:9:16587)"}
注意:我隐藏了 [MY_SITE_LINK_ADDRESS]。
【问题讨论】:
-
我用上面的示例代码做了一个测试。分享按钮在包括 IE 和 Edge 在内的所有浏览器中显示良好。当我点击它时,我在包括 Chrome 在内的所有浏览器中都遇到了不同的错误。您也可以通过在网页上运行以上 2 行来查看错误来进行测试。如果我们检查您的控制台错误,它还会说这些是来自 Linkedin 的脚本文件。所以很可能他们的网站或插件有一些问题。正如他们的文件中显示的错误,我们无法从我们这边纠正它。
标签: reactjs internet-explorer share linkedin microsoft-edge