现在的位置: 网页制作教程网站制作经验 >正文
代码插件

百度分享不支持https的解决办法

发表于2018/10/17 网站制作经验 0条评论 ⁄ 热度 3,510℃

自从网站由http升级到了https,就发现原先的百度分享不好使了。查询百度分享官方站点,并没有找到替代品或行之有效的解决方法。

也就是说百度分享目前还不支持https站点,但真的就没有解决办法了吗?今天小编就带来这边教程,教您如何在https站点下使用百度分享。

直接下载百度分享 HTTPS 资源包

1、首先前往 GitHub 下载百度分享的全部资源文件:https://github.com/hrwhisper/baiduShare

2、前往百度分享主页定制化你自己需要的分享内容以及排序等,然后获得的代码类型如下:

<divclass="bdsharebuttonbox">
 <a href="#"class="bds_more"data-cmd="more"></a>
 <a href="#"class="bds_qzone"data-cmd="qzone"title="分享到 QQ 空间"></a>
 <a href="#"class="bds_tsina"data-cmd="tsina"title="分享到新浪微博"></a>
 <a href="#"class="bds_tqq"data-cmd="tqq"title="分享到腾讯微博"></a>
 <a href="#"class="bds_renren"data-cmd="renren"title="分享到人人网"></a>
 <a href="#"class="bds_weixin"data-cmd="weixin"title="分享到微信"></a>
</div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-newDate()/36e5)];
</script>

到这里HTTPS站点就可以正常使用百度分享了。

Share.js 中所包含的其他 JavaScript、CSS 以及图片等使用的是绝对路径,如果你进行定制化的修改则需要同步进行修改。

  • 暂无评论