/static/api/js/share.js?v=89860593.js?cdnversion=432422解决方法

使用begin的模板将网站设置完成查看源码发现提示错误:/static/api/js/share.js?v=89860593.js?cdnversion=432422

原因分析:

经过检查发现是百度分享代码错误导致。由于没有找到本地的分享代码地址,导致错误。

解决方法:

方法一、修改模板路径下的js/bd-share-l.js中的代码。

var ishttps = ‘https:’ == document.location.protocol ? true: false;

if(ishttps){
with(document) 0[(getElementsByTagName(‘head’)[0] || body).appendChild(createElement(‘script’)).src = ‘https://’ + window.location.host + ‘/static/api/js/share.js?v=89860593.js?cdnversion=’ + ~ ( – new Date() / 36e5)];
}else{
with(document) 0[(getElementsByTagName(‘head’)[0] || body).appendChild(createElement(‘script’)).src = ‘http://’ + window.location.host + ‘/static/api/js/share.js?v=89860593.js?cdnversion=’ + ~ ( – new Date() / 36e5)];
}

将以上代码修改为:

var ishttps = ‘https:’ == document.location.protocol ? true: false;

if(ishttps){
with(document) 0[(getElementsByTagName(‘head’)[0] || body).appendChild(createElement(‘script’)).src = ‘https://’ + window.location.host + ‘http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=’ + ~ ( – new Date() / 36e5)];
}else{
with(document) 0[(getElementsByTagName(‘head’)[0] || body).appendChild(createElement(‘script’)).src = ‘http://’ + window.location.host + ‘http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=’ + ~ ( – new Date() / 36e5)];
}

方法二:将百度的分享代码下载下来放到网站根目录下。

伸手党下载百度分享代码:
https://github.com/hrwhisper/baiduShare

下载方式如下:

github download method

static 解压后丢到站点根目录下即可。

(使用begin主题的这步可以不做)然后对应的百度分享代码中,把http://bdimg.share.baidu.com/改为 /

.src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
改为
.src='/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>

以上解决方法来源于 front-gl 的分享资料。

●本文来源互联网及网友投稿,如有侵权请及时联系本站进行删除。
●转载原创文章请保留地址及版权信息,否则侵权必究。
●分享目的仅供大家学习和交流,请不要用于商业用途。
●该资源版权归原著作者所有,请于下载后24小时内删除。
●如有链接无法下载、失效或广告,请联系右侧点击QQ咨询处理。
●本站资源售价只是赞助,收取费用仅维持本站的日常运营所需。
●如遇到加密压缩包,默认解压密码为"fdeer.com",如遇到无法解压的请联系管理员。

飞鹿日志 » /static/api/js/share.js?v=89860593.js?cdnversion=432422解决方法