Solution for using Baidu share on Https page

Solution for using Baidu share on Https page

Since enabling https access for the entire site, the sharing code has not been available, and the small green icon that was enabled has become a gray icon. Alas, I have put a lot of effort into this little green label. Baidu ads have been basically removed, Baidu site search has also been basically removed, and the sharing function is just a decoration. Some fellow researchers asked me why I couldn’t share. In fact, it’s not that I don’t want to share, but my ability is limited and I can’t solve this problem. I happen to have some free time today, so I plan to solve this sharing problem.

So I searched on the Internet and found that there are quite a few people with this problem. Fortunately, someone has already provided a solution to this problem.

Workaround

The solution comes from Whispering. Please note that the website may be blocked and a proxy is required. The code is shared on Gihhub.

The general solution is to change Baidu's sharing code to local code, so that you don't have to call Baidu's sharing code through http every time. The code can be downloaded from github.

After decompression, drop static into the root directory of the site.

Related file download address:

http://bdimg.share.baidu.com/Change to/Github address: https://github.com/hrwhisper/baiduShare

Or click here to download

Download and unzip to get the static folder

Then modify the js we referenced

Modified to:

.src='https://www.xxx.cn/inc/uploads/online/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>

Please change the domain name to your own. ok, problem solved. Percent sharing appears again!

<<:  Details of the underlying data structure of MySQL indexes

>>:  Docker custom network detailed introduction

Recommend

Three common ways to embed CSS in HTML documents

The following three methods are commonly used to d...

Analysis and description of network configuration files under Ubuntu system

I encountered a strange network problem today. I ...

How MLSQL Stack makes stream debugging easier

Preface A classmate is investigating MLSQL Stack&...

JS calculates the probability of winning based on the prize weight

Table of contents 1. Example scenario 1.1. Set th...

js to implement a simple bullet screen system

This article shares the specific code of native j...

JavaScript to add and delete messages on the message board

This article shares a small example of adding and...

A brief discussion on HTML doctype and encoding

DOCTYPE Doctype is used to tell the browser which...

Better looking CSS custom styles (title h1 h2 h3)

Rendering Commonly used styles in Blog Garden /*T...

Detailed explanation of Vue save automatic formatting line break

I searched for many ways to change it online but ...

SQL-based query statements

Table of contents 1. Basic SELECT statement 1. Qu...

WeChat applet implements search function and jumps to search results page

Search Page: search.wxml page: <view class=&qu...