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

Problems and solutions encountered when installing mininet on Ubuntu 16.04.4LTS

Mininet Mininet is a lightweight software defined...

Detailed steps for developing Java payment interface for Alipay

Table of contents first step Step 2 Step 3 Step 4...

Three ways to check whether a port is open in a remote Linux system

This is a very important topic, not only for Linu...

JavaScript to achieve calendar effect

This article shares the specific code for JavaScr...

Docker container operation instructions summary and detailed explanation

1. Create and run a container docker run -it --rm...

MySQL backup table operation based on Java

The core is mysqldump and Runtime The operation i...

Problems with creating placeholders for HTML selection boxes

I'm using a placeholder in a text input and i...

Design of pop-up windows and floating layers in web design

In the trend of gradual transition from tradition...

Use semantic tags to write your HTML compatible with IE6,7,8

HTML5 adds more semantic tags, such as header, fo...

How to display a small icon in front of the browser URL

When you browse many websites, you will find that ...

MySQL uses SQL statements to modify table names

In MySQL, you can use the SQL statement rename ta...