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

Several important MySQL variables

There are many MySQL variables, some of which are...

Html and CSS Basics (Must Read)

(1) HTML: HyperText Markup Language, which mainly...

Detailed explanation of the use of mysql explain (analysis index)

EXPLAIN shows how MySQL uses indexes to process s...

JS operation object array to achieve add, delete, modify and query example code

1. Introduction Recently, I helped a friend to ma...

Modify the jvm encoding problem when Tomcat is running

question: Recently, garbled data appeared when de...

Specific usage of textarea's disabled and readonly attributes

disabled definition and usage The disabled attrib...

3 simple ways to achieve carousel effects with JS

This article shares 3 methods to achieve the spec...

Linux virtual memory settings tutorial and practice

What is Virtual Memory? First, I will directly qu...

Summary of the differences between Html, sHtml and XHtml

For example: <u> This has no ending characte...

Solution to the conflict between Linux kernel and SVN versions

Phenomenon The system could compile the Linux sys...

Detailed explanation of creating and calling MySQL stored procedures

Table of contents Preface Stored Procedure: 1. Cr...