TypechoJoeTheme

香草物语

统计
登录
用户名
密码
/
注册
用户名
邮箱
输入密码
确认密码

关于SSL网站百度分享不支持HTTPS加密连接的解决方案

Laughing博主
2017-06-15
/
0 评论
/
982 阅读
/
349 个字
/
百度已收录
06/15
本文最后更新于2024年03月20日,已超过50天没有更新。如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢!

百度分享在百度公司内部应该是已经被边缘化的产品了,毕竟分享类和评论类的产品盈利方面都比较麻烦。百度分享到目前为止估计也已经有两三年没有更新过了,其官方网站的资讯更新至今还停留在2012年的时候。这么长时间未更新以至于现在百度系很多产品都HTTPS化了百度分享仍然还是不支持,对开发者来说很麻烦。如果网站已经启用全站HTTPS则使用百度分享后会出现加载问题,百度分享的核心JavaScript会被拦截掉。已经有站长在GitHub上分享了HTTPS版的解决方案,就是直接将所有代码和资源托管在自己的服务器上。

以下是百度分享HTTPS版的解决方案:

  • 首先前往GitHub下载百度分享的全部资源文件:https://github.com/hrwhisper/baiduShare
  • 将资源文件上传至服务器如:https://www.xiangcaowuyu.net/static/api/
  • 前往百度分享主页定制化你自己需要的分享内容以及排序等,然后获得的代码类型如下:

    <div id="footer" alog-group="log-footer">  
    <div class="foot">  
      <?php wp_reset_query();if ( is_home()){ ?>    
          <div id="links">  
              <ul class="linkcat">  
                  <li><strong>友情链接:</strong></li>  
                  <?php  
                  wp_list_bookmarks('title_li=&categorize=0&orderby=rand&show_images=&limit=30&category='.get_option('ygj_link_id'));   
                  ?>  
              </ul>  
    <div class="clear"></div>  
    </div>  
      <?php } ?>  
    <div class="ps">  
    <div class="p p2">  
    <div class="p-content">  
    <p class="t2">站点相关</p>  
    <ul>  
    <?php echo stripslashes(get_option('ygj_yjcylj')); ?>  
    </ul>  
    </div>  
    <div class="clear"></div>  
    <div class="site-info">           
              Copyright ©&nbsp; <?php bloginfo('name');?><span class="plxiaoshi"> &nbsp; | &nbsp; </span>  
          </div>  
    </div><div class="p p3">  
    <div class="p-content">  
    <p class="t2">欢迎您关注我们</p>  
    <div class="qcode clearfix">  
    <div class="img-container">  
    <img src="<?php echo stripslashes(get_option('ygj_gzwm_ewm')); ?>" alt="<?php bloginfo('name'); ?>的公众号">  
    </div>  
    <div class="link-container">  
    <a href="<?php echo stripslashes(get_option('ygj_gzwm_lj1')); ?>" target="_blank">  
    <?php echo stripslashes(get_option('ygj_gzwm_bt1')); ?></a>  
    <a href="<?php echo stripslashes(get_option('ygj_gzwm_lj2')); ?>" target="_blank">  
    <?php echo stripslashes(get_option('ygj_gzwm_bt2')); ?></a>  
    </div>  
    </div>  
    </div>  
    </div>  
    </div>  
    </div>  
    </div>  
    <div class="tools">  
      <a class="tools_top" title="返回顶部"></a>  
      <?php wp_reset_query(); if ( is_single() || is_page() ) { ?>  
          <a class="tools_comments" title="发表评论"></a>  
      <?php } else {?>  
          <a href="<?php echo stripslashes(get_option('ygj_lyburl')); ?>#respond" class="tools_comments" title="给我留言" target="_blank" rel="nofollow"></a>  
      <?php } ?>  
    </div>  
    <?php if (!get_option('ygj_post_baidu') ) { ?>  
    <?php if (is_single() || is_page() ) { ?>  
    <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='https://www.lisen.xyz/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>  
    <?php }} ?>  
    <script type="text/javascript" src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/superfish.js"></script>  
    <?php wp_footer(); ?>  
    </body></html>
  • 将下载的文件解压,得到static文件夹,将static文件夹以及下面的内容上传到网站根目录。
朗读
赞(1)
赞赏
感谢您的支持,我会继续努力哒!
版权属于:

香草物语

评论 (0)
  1. 云缠月 闲逛
    Windows 7 · Google Chrome

    这样精彩的博客越来越少咯!

    2017-12-15 回复
  2. 康乐民博客 闲逛
    Windows 7 · QQ Browser

    多谢博主,解决问题!我的问题已经解决了,但是CDN镜像CSS文件的时候会出现权限报错,这个该怎么解决呢?

    2017-07-09 回复