Preface:
Small program update iteration step by step, despite continued on pit, but overall is becoming more and more strong, today we have for the web – the view component of small programs, believe that there are many friends have stepped over the pit of the company, but because of the web – the view on personal type does not support, so there are a lot of friends have no way to get started, but it doesn’t matter. So let me just say a little bit, how does web-view actually embed H5? How do you configure it? ### Let’s introduce web-view. If you have seen the official API, you can automatically ignore it and go directly to the configuration step
Function is introduced
The Web-view component is a container that can be used to host web pages and automatically fills the entire applet page. Similar to the Frame, Iframe, and Frameset tags, web-View is not flexible enough for now, but many people are happy with it. (If I have to laugh, I just want to say that web-view was born in my time. Don’t mention it, a bitter tears)
Usage and late configuration limitations
- Applets of personal type and overseas type are not supported.
- Js-sdk interface restrictions (please refer to official API for details).
- There can only be one < web-view /> per page.
- A maximum of 20 service domain names can be added.
- You can change a service domain name only 50 times a year.
web-view
attribute | type | The default value | instructions |
---|---|---|---|
src | String | none | Webview a link to a web page. You need to log in to the mini program management background to configure the domain name whitelist. |
The sample code
<! SRC ="h5 address link "></web-view>Copy the code
The configuration steps
1. Configure the service domain name. 2Copy the code
① — Configure the service domain name
Step name | | show | — – | — – | a | | check file download check files (GH0XFEdVsr. TXT) and then ask the service side friends cooperate, will check files placed in the root of the domain name will be nested business directory () in the absence of any child directory, example: h5 page: Mp.weixin.qq.com/index.html, so you need to configure the mp.weixin.qq.com/GH0XFEdVsr.txt, of course you can also specify a straton level directory under this domain (only the current directory after the specified HTML support nested), after the success of the check, Only then can you configure the business domain name for step 2. Two domain name | | configuration example: mp.weixin.qq.com/
The diagram below:
② — Select the base library
This step is the easiest, but it’s the one most people ignore (ahem…). , Developer Tools -> Details Settings -> select version 1.6.4 or later (currently only supported to 1.6.4).
The diagram below:
Conclusion:
The above is a simple web-view configuration process, most of the content of the applets official API has been given, here is just the configuration process steps further detailed, become a little more popular, but if you need to do some operations in the H5 page…. Take a look at the official example: Fast Track
<! - HTML -- > < script type = "text/javascript" SRC = "https://res.wx.qq.com/open/js/jweixin-1.3.0.js" > < / script > / / Javascript wx. MiniProgram. NavigateTo ({url: '/ path/to/page'}) / / here it is ok to encapsulate jump...Copy the code
(Note: If the debugging tool starts web-view normally and wechat cannot be opened on the mobile phone, don’t worry, just upgrade the wechat version, and make compatibility with the lower version in the actual project.)
END
The first nuggets article, hope everyone to support and inclusion, but also welcome everyone to ridicule comments… I hope to know more good teachers and helpful friends, and I will share some problems or interesting things I have encountered in the future. Thank you.
(Note: the cover is from the Internet, if there is infringement, please contact the author to delete; If you need to reprint, please attach the original link and signature, thank you)