解决百度分享不支持https问题 百度分享资源包下载

2016年12月13日15:02:16网站建设评论434

通过HTTPS访问某个页面时,会自动禁止加载页面内的HTTP资源,而我们亲爱的百度分享到现在还不支持HTTPS访问(主要是证书有问题)。so,如果你的站点使用了百度分享,那通过https访问你站点页面时百度分享的功能就不能用了。文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

目前最简单的办法就是将百度分享的代码本地化,使用本地的百度分享代码完成百度分享的所有功能。百度分享代码及资源内容较多,自己一个个从源站撸耗时耗力,已经有网友准备好了,我们要做的就是下载下来部署到自己支持https 的站点上。文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

百度分享本地化资源包下载:https://github.com/hrwhisper/baiduShare文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

下载方式如下:文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

github-download-method文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

static 解压后丢到站点根目录下即可。文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

然后对应的百度分享代码中,把http://bdimg.share.baidu.com/改为 /文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

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

作者官网 同时给出了资源本地化的详细操作步骤,感兴趣的可以去学习下。好了,快试试本地后的百度分享效果吧。文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

如你不想将百度分享资源包本地化,也可以使用七牛、又拍、腾讯OSS+CDN等支持HTTPS的云存储或CDN建一个自用的百度分享站。文章源自堕落的鱼-https://www.duoluodeyu.com/2378.html

匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定