Home WeChat Applet Mini Program Development A brief analysis of how to jump from applet to H5 page? (Example analysis)

A brief analysis of how to jump from applet to H5 page? (Example analysis)

Jan 18, 2022 am 10:01 AM
WeChat applet Jump

How to jump from applet to H5 page? The following article will introduce to you how to jump to the H5 page in WeChat Mini Program. I hope it will be helpful to you!

A brief analysis of how to jump from applet to H5 page? (Example analysis)

WeChat Mini Program: Although the development method is similar to a web page, it is actually a self-developed program that can only run on WeChat A special web page in the browser, all functions it can use must be provided by WeChat Browser;

H5 page: This is a real web application, running in a general browser , although various browsers have subtle differences, they are generally the same. WeChat Browser is also a general browser that can support real web applications.

Therefore, it is possible for us to jump between the WeChat applet and the H5 page, but this jump is strictly controlled by the WeChat browser, so it is necessary for us to understand that these controls include Which.

The domain name where the H5 page is located: Suppose the URL of the H5 page you need to transfer is https://www.mysite.com/h5page, then the domain name mentioned here is www .mysite.com, and you read that right, this URL must be https. If you haven’t added SSL to your website, then apply for a certificate first (note that it must be Publicly applied certificates cannot be self-signed, WeChat will not recognize them!)

Okay, these are all ready, let's start developing a small example.

Since the web-view component is a full-screen component and cannot be used with other mini program components, it needs to occupy a separate page, so our example is to add one to the A page of the mini program link, jump to page B, and then use the web-view component on page B to load the H5 page.

A page

<view class="answerer flex-wrp" bindtap=&#39;jumpToH5&#39;>
        <view class="avatar flex-item">
            <image src="/images/logo-small.jpg"></image>
        </view>
        <view class="answerer-info flex-item">
            <text class="answerer-name">文章标题</text>
            <text class="answerer-des">文章摘要</text>
        </view>
        <view class="follow flex-item">
            <text>十 关注</text>
        </view>
</view>
Copy after login
jumpToH5: function () {
    wx.navigateTo({
      url: &#39;/pages/B&#39;
    })
  },
Copy after login

B page

<web-view src="{{link}}" bindmessage="getMessage"></web-view>
Copy after login
  data: {
    link: "https://www.mysite.com/h5page"
  },
Copy after login

At this time, when you click on the link with full hope, the first page will appear. One hurdle: Unbound web developer

A brief analysis of how to jump from applet to H5 page? (Example analysis)

What the hell is this? It turns out that using the web-view component is not allowed by anyone who comes up. Yes, the first authorization is required at this time, which is to authorize the developer to use the component. What's more ridiculous here is that although this component is used by the mini program, it cannot be set in the mini program development account, but must be set in the subscription account or service account, network The screenshot below that can often be found on the Internet can only be seen by logging in to Subscription Account or Service Account.

A brief analysis of how to jump from applet to H5 page? (Example analysis)

After setting and binding the developer’s WeChat account here, we can finally use the web-view component, but this time it appears again New question: Opening non-business domain names is not supported.

A brief analysis of how to jump from applet to H5 page? (Example analysis)

It turns out that you can’t just use any URL to set up a jump. You can’t jump directly to Baidu in your mini program. Go up, the domain name that the mini program can jump to must be registered in Business Domain Name. Finally, this time it is set in the mini program development account, but pay attention to the settings in Service Account There is also a setting for business domain names, so don’t get confused (the naming of WeChat is too unimaginative, it’s just a mess).

After setting up this business domain name, I happily opened the mini program, clicked the link, What! Again, this time the problem became: redirect_uri parameter error

A brief analysis of how to jump from applet to H5 page? (Example analysis)

At this time, control has been transferred from the applet to the H5 page, but the internal mechanism of the WeChat page jump is relatively It is complicated and involves OAuth authentication and the like, so this error has already been reported on the H5 page. This requires setting up the service number associated with the H5 page. The item set this time is called Webpage authorized domain name, in the function settings of the official account settings

A brief analysis of how to jump from applet to H5 page? (Example analysis)

After adding the domain name that needs to be jumped, you can finally see the H5 page appearing in the debugger On!

Finally, let’s popularize the differences between the three types of accounts on the WeChat public platform

Service account: supports the most Web development interfaces and JS development interfaces, and is the most conventional Application development account;
Subscription account: Used for publishing articles, with relatively few development interfaces and not supporting many functions. It is the stupidest article publishing account;
小program: Exclusive development account for mini program applications. It only supports the development of mini programs. Many settings must be set in the first two types of accounts.

【Related learning recommendations: 小program development tutorial

The above is the detailed content of A brief analysis of how to jump from applet to H5 page? (Example analysis). For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
Xianyu WeChat mini program officially launched Xianyu WeChat mini program officially launched Feb 10, 2024 pm 10:39 PM

Xianyu's official WeChat mini program has quietly been launched. In the mini program, you can post private messages to communicate with buyers/sellers, view personal information and orders, search for items, etc. If you are curious about what the Xianyu WeChat mini program is called, take a look now. What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3. If you want to use it, you must activate WeChat payment before you can purchase it;

Implement image filter effects in WeChat mini programs Implement image filter effects in WeChat mini programs Nov 21, 2023 pm 06:22 PM

Implementing picture filter effects in WeChat mini programs With the popularity of social media applications, people are increasingly fond of applying filter effects to photos to enhance the artistic effect and attractiveness of the photos. Picture filter effects can also be implemented in WeChat mini programs, providing users with more interesting and creative photo editing functions. This article will introduce how to implement image filter effects in WeChat mini programs and provide specific code examples. First, we need to use the canvas component in the WeChat applet to load and edit images. The canvas component can be used on the page

How to implement PHP code to jump to a specified page How to implement PHP code to jump to a specified page Mar 07, 2024 pm 02:18 PM

When writing a website or application, you often encounter the need to jump to a specific page. In PHP, we can achieve page jump through several methods. Below I will demonstrate three common jump methods for you, including using the header() function, using JavaScript code, and using meta tags. Using the header() function The header() function is a function used in PHP to send original HTTP header information. This function can be used in combination when implementing page jumps. Below is a

Implement the drop-down menu effect in WeChat applet Implement the drop-down menu effect in WeChat applet Nov 21, 2023 pm 03:03 PM

To implement the drop-down menu effect in WeChat Mini Programs, specific code examples are required. With the popularity of mobile Internet, WeChat Mini Programs have become an important part of Internet development, and more and more people have begun to pay attention to and use WeChat Mini Programs. The development of WeChat mini programs is simpler and faster than traditional APP development, but it also requires mastering certain development skills. In the development of WeChat mini programs, drop-down menus are a common UI component, achieving a better user experience. This article will introduce in detail how to implement the drop-down menu effect in the WeChat applet and provide practical

WeChat applet implements image upload function WeChat applet implements image upload function Nov 21, 2023 am 09:08 AM

WeChat applet implements picture upload function With the development of mobile Internet, WeChat applet has become an indispensable part of people's lives. WeChat mini programs not only provide a wealth of application scenarios, but also support developer-defined functions, including image upload functions. This article will introduce how to implement the image upload function in the WeChat applet and provide specific code examples. 1. Preparatory work Before starting to write code, we need to download and install the WeChat developer tools and register as a WeChat developer. At the same time, you also need to understand WeChat

What is the name of Xianyu WeChat applet? What is the name of Xianyu WeChat applet? Feb 27, 2024 pm 01:11 PM

The official WeChat mini program of Xianyu has been quietly launched. It provides users with a convenient platform that allows you to easily publish and trade idle items. In the mini program, you can communicate with buyers or sellers via private messages, view personal information and orders, and search for the items you want. So what exactly is Xianyu called in the WeChat mini program? This tutorial guide will introduce it to you in detail. Users who want to know, please follow this article and continue reading! What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3.

How to implement page jump in 3 seconds: PHP Programming Guide How to implement page jump in 3 seconds: PHP Programming Guide Mar 25, 2024 am 10:42 AM

Title: Implementation method of page jump in 3 seconds: PHP Programming Guide In web development, page jump is a common operation. Generally, we use meta tags in HTML or JavaScript methods to jump to pages. However, in some specific cases, we need to perform page jumps on the server side. This article will introduce how to use PHP programming to implement a function that automatically jumps to a specified page within 3 seconds, and will also give specific code examples. The basic principle of page jump using PHP. PHP is a kind of

Use WeChat applet to achieve carousel switching effect Use WeChat applet to achieve carousel switching effect Nov 21, 2023 pm 05:59 PM

Use the WeChat applet to achieve the carousel switching effect. The WeChat applet is a lightweight application that is simple and efficient to develop and use. In WeChat mini programs, it is a common requirement to achieve carousel switching effects. This article will introduce how to use the WeChat applet to achieve the carousel switching effect, and give specific code examples. First, add a carousel component to the page file of the WeChat applet. For example, you can use the &lt;swiper&gt; tag to achieve the switching effect of the carousel. In this component, you can pass b

See all articles