我实现了将共享计数按钮链接到网页。这是我有的HTML和JS代码
<li>
<script type="IN/Share" data-url="<?php echo $linkedin_url; ?>" id="<?php echo $id; ?>" data-counter="top"></script>
<script>
debugger;
if (typeof (IN) != 'undefined') {
IN.parse();
} else {
opjq.getScript("http://platform.linkedin.com/in.js");
}
</script>
</li>
在控制台中我遇到了javascript错误
secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1406 Uncaught TypeError: Cannot read property 'className' of null
at Object.addClass (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1406)
at B.<anonymous> (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:2926)
at B.setContent (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:308)
at B.<anonymous> (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1900)
at B.setCountFormatted (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:308)
at o (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1937)
at b (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1939)
at Function.handleCount (secureAnonymousFramework?v=0.0.2000-RC8.61320-1429&:1908)
at share?url=http%3A%2F%theme.app%2Fwp-admin%2Fadmin.php%3Fpage%page-b…:1
有没有人知道这个错误?
答案 0 :(得分:1)
当我尝试在本地测试时,我收到相同的错误消息。 secureAnonymous javascript文件中有一个正则表达式,它试图检测您当前的页面。 (https://platform.linkedin.com/js/secureAnonymousFramework)协议以'file://'开头时失败。在远程主机上,它将正常工作。