The implementation process of long pressing to identify QR code in WeChat applet

The implementation process of long pressing to identify QR code in WeChat applet

Preface

We all know that the QR codes in official accounts can be long-pressed for recognition, but the restrictions on mini-programs are relatively strict, and there is no way to achieve long-press recognition of QR codes. I have always believed this, and this is also written in the official rules of WeChat. Until this morning, I accidentally discovered that the QR code in a mini-program can actually be long-pressed for recognition, so I curiously studied it, and it turned out that it is really possible to long-press and recognize QR codes in mini-programs. I don't know if it's an official loophole or a bug in the program, but since this function can be realized, of course I have to use it happily.

As usual, let’s look at the renderings first

As you can see, we have successfully implemented the function of long pressing to recognize the QR code in the mini program. Let me teach you how to achieve it step by step. Because the official specifications have not yet clearly stated that this feature is supported, this feature may be disabled at any time. I'll let you guys have some fun here first, and have fun for as long as you can.

First, use webview to display the official account articles

We know that the official account articles have the function of long pressing to identify the QR code, so we must first long press to identify the QR code in the mini program, and then we must display the official account articles in the mini program. How to display the official account articles in the mini program? Here we have to use webview. Webview is very simple to use, just follow the steps below.

src is the link corresponding to our official account article. You only need to write it like this to complete the code part, and the rest is some configuration work.

Second, you must link your mini program to the official account

If you just find a link to a public account article and put it in the webview, the following problems will occur

Next, we need to link the mini program in the background of the official account.

I won’t explain here where to find the appid of the mini program. If you have learned mini programs, you will definitely know where to get the appid.

3. After setting, you can directly long press to identify

After the above association, there will be a delay of several minutes, so it is best to close the developer tools and then reopen them.

You can see that we have successfully displayed the articles of the official account in the webview of the mini program. Then preview it on your phone as follows

It can be seen that this is a standard public account article with a QR code at the end. So can we recognize this QR code by long pressing it?

It can be seen that we successfully long-pressed and recognized the QR code.

At this point, we have successfully implemented long press to recognize QR codes in the mini program. . .

You should try it as soon as possible. I cannot guarantee 100% success because WeChat officials have not yet clearly developed this function. But now that mini programs can be shared to Moments, I believe that long pressing to identify QR codes in mini programs will not be prohibited, so take this opportunity to try this feature.

Summarize

This is the end of this article about long press to identify QR code in WeChat mini program. For more relevant WeChat mini program long press to identify QR code content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Example of how to use WeChat applet webview to recognize QR code by long pressing
  • WeChat applet clicks on the picture to realize long press preview, save, identify QR code with parameters, forward and other functions

<<:  How to set up FTP server in CentOS7

>>:  How to delete extra kernels in Ubuntu

Recommend

Detailed explanation of JavaScript axios installation and packaging case

1. Download the axios plugin cnpm install axios -...

Several ways to improve the readability of web pages

1. Use contrasting colours. The contrast here ref...

Detailed explanation of how to configure Nginx web server sample code

Overview Today we will mainly share how to config...

How to solve the high concurrency problem in MySQL database

Preface We all know that startups initially use m...

MySQL 5.7.20 zip installation tutorial

MySQL 5.7.20 zip installation, the specific conte...

Detailed explanation of docker entrypoint file

When writing a Dockerfile, include an entrypoint ...

Vue implements three-dimensional column chart based on echarts

The three-dimensional column chart consists of th...

MySQL encoding utf8 and utf8mb4 utf8mb4_unicode_ci and utf8mb4_general_ci

Reference: MySQL character set summary utf8mb4 ha...

How to create a responsive column chart using CSS Grid layout

I have been playing around with charts for a whil...

Solution to uninstalling Python and yum in CentOs system

Background of the accident: A few days ago, due t...

Pure CSS to achieve a single div regular polygon transformation

In the previous article, we introduced how to use...