Method and device for opening three-party web page by WeChat applet webview
By configuring a subdomain on our own primary domain and using a proxy server for relaying, we solved the problem of WeChat Mini Programs being unable to load third-party web pages. This enabled normal display without configuring verification files on third-party servers, making it suitable for secure data transmission and rendering in multiple business scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, WeChat mini programs cannot directly load and display third-party web pages, mainly because WeChat verification files need to be configured on the third-party server, and personal mini programs do not have permission to use the web-view component, which makes it impossible to embed third-party web pages normally.
By configuring a subdomain under your own primary domain name and applying for a digital certificate, and using a proxy server as an intermediary, you can bypass the restriction of configuring WeChat verification files on a third-party server and enable the webview component to load third-party web pages.
It eliminates the need to configure WeChat verification files on third-party servers, enabling the normal display of third-party web pages within WeChat Mini Programs. It is suitable for multiple business scenarios and ensures data transmission security and the legality of page rendering.
Smart Images

Figure CN121658733A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of WeChat Mini Program development and web page integration, and in particular to a method and apparatus for opening a third-party web page using a WeChat Mini Program webview. Background Technology
[0002] In existing technologies, WeChat mini programs rely on the web-view component to load and display third-party web pages. However, the use of this component has clear prerequisites and configuration constraints: First, the base library version must be 1.6.4 or higher; lower versions require additional compatibility logic development. Second, only enterprise / organization mini programs have permission to use this component; personal mini programs do not currently support it.
[0003] At the domain configuration level, in the "Development Management - Business Domains" module of the mini program backend, you need to pre-configure the valid HTTPS domains of the third-party pages (up to 200 can be configured), and the iframe domains embedded in the third-party pages also need to be configured synchronously; at the same time, the backend server corresponding to the third-party pages needs to cooperate by placing the verification file provided by WeChat in the root directory of the domain name to complete the domain validity verification, otherwise the web-view component will not be able to load the third-party pages normally.
[0004] In existing technologies, a validation file must be added to the server under the business domain name to enable the webview to open the page. However, in many scenarios, the web page itself is a third-party web form page that needs to be directly embedded into the webview. However, due to differences between companies, significant business differences, and poor team communication, it is impossible to write the validation file of our business mini-program on the third-party server, thus making it impossible for the webview to open the third-party page. Summary of the Invention
[0005] In view of this, this application proposes a method for opening a third-party web page using a WeChat Mini Program webview, including the following steps: Get the page opening request from the WeChat mini program; Based on the page opening request, call the subdomain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program; Send the request to the subdomain to the preset proxy server; Based on the proxy server, requests pointing to the second-level domain are forwarded to the domain address corresponding to the third-party web page; The webview component of the WeChat mini program loads and displays the third-party web page obtained after being forwarded by the proxy server.
[0006] In one possible implementation, calling the subdomain corresponding to the self-owned first-level domain already configured in the WeChat Mini Program based on the page opening request includes the following steps: Configure the target subdomain information that has been filed and associated with your own primary domain in the WeChat Mini Program backend; The target subdomain information includes the subdomain address and the corresponding digital certificate validity period; Verify the status of the mathematical certificate for the target subdomain to confirm that the mathematical certificate is valid and has not expired; Based on the business type of the page opening request, match and call the target subdomain corresponding to the business type. The matching relationship between the business type and the subdomain is pre-stored in the local configuration file of the WeChat Mini Program.
[0007] In one possible implementation, sending a request to a subdomain to a pre-defined proxy server includes the following steps: Encapsulate the parameters for requests pointing to the second-level domain; Establish an encrypted communication connection with the preset proxy server through the HTTPS protocol to verify whether the domain name of the proxy server is consistent with the domain name configuration of the WeChat Mini Program backend and whether it can be accessed normally. The encapsulated request data is sent to the proxy server, and the response returned by the proxy server is received.
[0008] In one possible implementation, forwarding requests to a subdomain to the domain address corresponding to the third-party web page, based on the proxy server, includes the following steps: The proxy server parses the received request data and extracts the domain name address and access path corresponding to the target third-party web page; The proxy server verifies the network connectivity of the subdomain corresponding to the third-party web page by sending test data packets to confirm that the subdomain can be accessed normally. The proxy server forwards the parsed request to the domain address corresponding to the third-party web page according to the original request format, and records the log information of the forwarded request.
[0009] In one possible implementation, the WeChat Mini Program's webview component loads and displays the third-party web page obtained after being forwarded by the proxy server, including the following steps: The webview component receives third-party web page data forwarded by the proxy server, validates the data format, and confirms that the data conforms to the HTML standard format. If the page data includes an embedded iframe tag, the webview component extracts the domain name corresponding to the iframe tag and verifies whether the domain name has been configured in the business domain name list in the WeChat Mini Program backend. The webview component loads page data according to the preset page rendering, and after completing the page layout rendering, it sends a loading completion signal to the WeChat mini program.
[0010] In one possible implementation, obtaining a WeChat Mini Program page opening request includes the following steps: Parse the page open request and extract the domain address and page access parameters corresponding to the third-party web page carried in the request; Verify the validity of page access parameters, filtering out parameters containing illegal characters or exceeding the preset length.
[0011] In one possible implementation, the preprocessing of a custom top-level domain includes the following steps: In the WeChat Mini Program backend, submit a configuration application for your own top-level domain name and upload the qualification certificate documents corresponding to the top-level domain name; Place the domain verification file provided by WeChat in the root directory of the server corresponding to your own top-level domain name to ensure that the WeChat server can access the verification file normally. The system receives the primary domain configuration returned by the WeChat Mini Program backend and stores the primary domain and associated secondary domain information in the WeChat Mini Program's local domain list configuration file.
[0012] This application also provides a device for opening third-party web pages in a WeChat mini-program webview, including: Request Acquisition Module: Used to acquire page opening requests from WeChat Mini Programs, receive third-party web page access instructions triggered by users, and extract core access parameters from the requests; Domain name call module: It communicates with the request retrieval module and is used to call the second-level domain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program according to the page opening request, and match the target second-level domain that meets the business requirements from the pre-stored domain name configuration list; Request sending module: Communicates with the domain name call module and is used to send requests pointing to the second-level domain name to the preset proxy server, establishing a compliant communication link with the proxy server; Request forwarding module: Deployed in a preset proxy server, it communicates with the request sending module and is used to forward requests pointing to the second-level domain to the domain address corresponding to the third-party web page, completing the parsing and relay of request data; Page loading module: Communicates with the request forwarding module and is integrated into the webview component of the WeChat Mini Program. It is used to load and display the third-party web page obtained after forwarding by the proxy server, and to realize the verification and rendering of page data.
[0013] In one possible implementation, the domain name invocation module includes: Domain name extraction unit: Used to extract target second-level domain name information that has completed filing and is associated with its own first-level domain name from the domain name configuration list pre-stored in the WeChat mini program backend. The target second-level domain name information includes the second-level domain name address and the corresponding digital certificate validity period. Certificate Verification Unit: Communicates with the Domain Name Extraction Unit and is used to verify the digital certificate status of the target second-level domain name. By verifying the certificate validity period and signature legality, it confirms that the certificate is valid and has not expired. Business matching unit: It communicates with the domain name extraction unit and the certificate verification unit respectively. It is used to match and call the target subdomain corresponding to the business type based on the business type of the page opening request. The matching relationship between business type and subdomain is pre-stored in the local configuration file of WeChat Mini Program, which supports accurate domain name calling in multiple business scenarios.
[0014] In one possible implementation, the page loading module includes: Data verification unit: Used to receive third-party web page data forwarded by the proxy server, verify the data format, confirm that the data conforms to the HTML standard format, and filter page data containing malicious code or illegal format; iframe verification unit: Communicates with the data verification unit and is used to extract the domain name corresponding to the iframe tag when the page data contains an embedded iframe tag, and query the business domain name list in the WeChat Mini Program backend to verify whether the domain name has been configured. Rendering Feedback Unit: Communicates with the iframe verification unit and is used to load page data according to preset page rendering rules. After completing the page layout rendering, it sends a page loading completion signal to the main program of the WeChat Mini Program and records the loading time and rendering status information simultaneously.
[0015] The beneficial effects of this invention are: By combining its own primary domain name verification with a secondary domain name proxy relay technology design, and based on the domain name configuration, HTTPS deployment and proxy forwarding scheme of this application, it is possible to bypass the core limitation of existing technologies that require placing WeChat verification files on third-party servers, thereby achieving the goal of embedding webviews into third-party web pages and displaying them normally without adding WeChat mini-program verification files to the servers of third-party pages.
[0016] Other features and aspects of this application will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0017] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this application together with the specification and serve to explain the principles of this application.
[0018] Figure 1 A flowchart illustrating a method for opening a third-party web page using a WeChat Mini Program webview according to an embodiment of this application; Figure 2 A block diagram showing a device for opening a third-party web page using a WeChat mini-program webview according to an embodiment of this application; Detailed Implementation Various exemplary embodiments, features, and aspects of this application will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.
[0019] It should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application or to simplify the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0020] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0021] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.
[0022] Furthermore, to better illustrate this application, numerous specific details are provided in the following detailed embodiments. Those skilled in the art should understand that this application can be implemented without certain specific details. In some instances, methods, means, components, and circuits well-known to those skilled in the art have not been described in detail in order to highlight the main points of this application.
[0023] The method and apparatus for opening third-party web pages in WeChat Mini Program WebView of this application is a technical solution based on its own domain name verification and proxy traffic transfer. It is applied in the field of WeChat Mini Program development and web page integration, and can achieve the function of embedding webview into third-party web pages and displaying them normally without adding WeChat Mini Program verification files to the server of the third-party page.
[0024] Specific references Figures 1-2 As a specific embodiment of the method and apparatus for opening a third-party web page using a WeChat mini-program webview according to this application, the method for opening a third-party web page using a WeChat mini-program webview includes the following steps: 101. Obtain the page opening request of the WeChat mini program.
[0025] Specifically, when a user triggers an action within a WeChat mini-program that wants to open a third-party web page, such as clicking a specific link or button, the mini-program's internal event listening mechanism will capture this action and generate a page opening request.
[0026] 102. Based on the page opening request, call the subdomain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program.
[0027] Specifically, WeChat Mini Programs have strict restrictions on the domains used to load third-party pages, and directly using third-party domains often fails to meet the requirements. To circumvent this restriction, technical staff pre-configure subdomains corresponding to their own primary domains within the Mini Program. When a page opening request is received, the Mini Program accurately selects the matching target subdomain from the pre-stored domain configuration list based on information such as the business type and target page characteristics carried in the request. For example, if it is a third-party form page request for a specific business scenario, the subdomain specifically configured for that scenario will be called. Furthermore, before calling the subdomain, the digital certificate status corresponding to the subdomain is verified to confirm that the certificate is valid and has not expired, ensuring that the domain can be used securely and compliantly.
[0028] 103. Send the request to the second-level domain name to the preset proxy server.
[0029] Specifically, before sending the request to the proxy server, the mini-program first encapsulates the parameters of the request pointing to the subdomain, integrating key information such as the request timestamp, unique request identifier ID, and access path of the target third-party web page into a package, making the request data format more standardized and easier for subsequent processing. Next, an encrypted communication connection is established with the preset proxy server via the HTTPS protocol. This ensures the security and integrity of data transmission and verifies whether the proxy server's IP address is on a preset whitelist. Only after successful verification can it be ensured that the request is sent to a trusted proxy server. After completing the above operations, the mini-program sends the encapsulated request data and waits for a request reception confirmation signal from the proxy server to confirm that the request has been successfully received by the proxy server.
[0030] 104. Based on the proxy server, forward requests pointing to the second-level domain to the domain address corresponding to the third-party web page.
[0031] Specifically, when it receives a request from a mini-program pointing to a subdomain, it first parses the request data, extracting key information such as the domain address and access path of the target third-party web page. To ensure the request successfully reaches the third-party page, the proxy server first verifies the network connectivity of the domain corresponding to the third-party web page by sending test data packets to confirm that the domain is currently accessible, avoiding requests failing due to third-party server malfunctions. After confirming network connectivity, the proxy server forwards the parsed request to the domain address of the third-party web page according to the original request format. It also records detailed log information of the forwarding request, including forwarding time, source request identifier ID, and target domain address. This log information is helpful for subsequent troubleshooting and business analysis.
[0032] 105. The webview component of the WeChat mini program loads and displays the third-party web page obtained after being forwarded by the proxy server.
[0033] Specifically, the WebView component, acting as the window for displaying third-party web pages within the mini-program, immediately performs rigorous data format validation upon receiving third-party web page data forwarded from the proxy server. This ensures the data conforms to HTML standards, preventing rendering errors and filtering out potentially malicious code to guarantee the mini-program's secure operation. If the page data contains embedded iframe tags, the WebView component extracts the domain name corresponding to the iframe tag and carefully queries the WeChat mini-program's backend business domain name list to verify its configuration. Only iframe content corresponding to domains with valid configurations can be loaded correctly. After completing these validation steps, the WebView component loads the page data according to preset page rendering rules, completes the page layout rendering, and ultimately presents the complete third-party web page to the user. It also sends a page loading completion signal to the WeChat mini-program, indicating that the page has been successfully displayed.
[0034] Furthermore, such as Figure 1 As shown, the method for opening a third-party web page using the WeChat Mini Program's webview proceeds as follows: Step 101: Obtain the page opening request from the WeChat Mini Program; Step 102: Based on the page opening request, call the second-level domain corresponding to the first-level domain already configured in the WeChat Mini Program; Step 103: Send the request pointing to the second-level domain to a preset proxy server; Step 104: Based on the proxy server, forward the request pointing to the second-level domain to the domain address corresponding to the third-party web page; Finally, in Step 105, the WeChat Mini Program's webview component loads and displays the third-party web page obtained after being forwarded by the proxy server.
[0035] Furthermore, this solution primarily involves applying for a subdomain yyy.xxx.com based on the primary domain xxx.com, then obtaining a digital certificate for this subdomain. In the WeChat Mini Program backend, the business domain is configured, including xxx.com. The verification file is then written to the root directory of the xxx.com server. Finally, an Nginx server is configured to listen on this newly applied subdomain and proxy all requests to the corresponding third-party page's domain address. This achieves the goal of using the owned domain, server, and verified file to proxy traffic to the desired third-party web page.
[0036] Step 1: Apply for a subdomain under your own top-level domain.
[0037] Step 2: Apply for a digital certificate for this domain name and configure it on the server so that it can be accessed via HTTPS.
[0038] Step 3: Configure the business domain name (first-level domain name) in the WeChat Mini Program backend.
[0039] Step 4: Placing the verification file in the root directory of the primary domain name server will enable WeChat verification to succeed.
[0040] Step 5: Configure a proxy server to forward traffic pointing to the subdomain to the specified path of the third-party server.
[0041] Step 6: No need to configure a verification file on the third-party server; you can access the third-party page normally through the webview.
[0042] In one possible implementation, calling the subdomain corresponding to the self-owned first-level domain configured in the WeChat Mini Program based on the page opening request includes the following steps: configuring the target subdomain information that has been filed and associated with the self-owned first-level domain in the WeChat Mini Program backend. The target subdomain information includes the subdomain address and the corresponding digital certificate validity period. Verifying the digital certificate status of the target subdomain confirms that the digital certificate is valid and has not expired. Based on the business type of the page opening request, matching and calling the target subdomain corresponding to the business type. The matching relationship between the business type and the subdomain is pre-stored in the local configuration file of the WeChat Mini Program.
[0043] In one possible implementation, sending a request to a subdomain to a preset proxy server includes the following steps: encapsulating the request to the subdomain with parameters, establishing an encrypted communication connection with the preset proxy server via HTTPS protocol, verifying that the domain name of the proxy server is consistent with the domain name configuration of the WeChat Mini Program backend and can be accessed normally, sending the encapsulated request data to the proxy server, and receiving the response returned by the proxy server.
[0044] In one possible implementation, forwarding a request to a subdomain to the domain address corresponding to a third-party web page, based on the proxy server, includes the following steps: the proxy server parses the received request data, extracts the domain address and access path corresponding to the target third-party web page, the proxy server verifies the network connectivity of the subdomain corresponding to the third-party web page by sending a test data packet to confirm that the subdomain can be accessed normally, the proxy server forwards the parsed request to the domain address corresponding to the third-party web page according to the original request format, and records the log information of the forwarded request.
[0045] In one possible implementation, the WeChat Mini Program's webview component loads and displays the third-party web page obtained after being forwarded by the proxy server, including the following steps: The webview component receives the third-party web page data forwarded by the proxy server, verifies the data format, confirms that the data conforms to the HTML standard format, if the page data includes an embedded iframe tag, the webview component extracts the domain name corresponding to the iframe tag, and verifies whether the domain name has been configured in the business domain name list in the WeChat Mini Program backend, the webview component loads the page data according to the preset page rendering, and after completing the page layout rendering, sends a loading completion signal to the WeChat Mini Program.
[0046] In one possible implementation, obtaining a WeChat Mini Program's page opening request includes the following steps: parsing the page opening request, extracting the domain name address and page access parameters corresponding to the third-party web page carried in the request, verifying the legality of the page access parameters, and filtering parameters that include illegal characters or exceed the preset length.
[0047] In one possible implementation, the preprocessing of a self-owned first-level domain includes the following steps: submitting a configuration application for the self-owned first-level domain in the WeChat Mini Program backend, uploading the qualification certificate document corresponding to the first-level domain, placing the domain verification file provided by WeChat in the root directory of the server corresponding to the self-owned first-level domain, ensuring that the WeChat server can access the verification file normally, receiving the first-level domain configuration approval notification returned by the WeChat Mini Program backend, and storing the first-level domain and associated second-level domain information in the local domain list configuration file of the WeChat Mini Program.
[0048] Specifically, this application utilizes its existing primary domain name to apply for a secondary domain name, writes the WeChat mini-program verification file to the root directory of the server under the primary domain name, and then configures a proxy server to redirect traffic that originally pointed directly to the third-party server through its own domain name and server, thereby enabling the embedding of the third-party page in the webview and its normal display.
[0049] This application also provides a device 100 for opening a third-party web page using a WeChat mini-program webview, including: Request Acquisition Module 110: Used to acquire page opening requests from WeChat Mini Programs, receive third-party web page access instructions triggered by users, and extract core access parameters from the requests.
[0050] Domain Name Call Module 120: Communicates with the Request Acquisition Module and is used to call the subdomain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program based on the page opening request, and to match the target subdomain that meets the business requirements from the pre-stored domain name configuration list.
[0051] Request sending module 130: Communicates with the domain name call module and is used to send requests pointing to the second-level domain name to the preset proxy server to establish a compliant communication link with the proxy server.
[0052] Request forwarding module 140: Deployed in a preset proxy server, it communicates with the request sending module and is used to forward requests pointing to the second-level domain to the domain address corresponding to the third-party web page, completing the parsing and relay of request data.
[0053] Page loading module 150: Communicates with the request forwarding module and is integrated into the webview component of the WeChat Mini Program. It is used to load and display the third-party web page obtained after forwarding by the proxy server, and to realize the verification and rendering of page data.
[0054] In one possible implementation, the domain name invocation module includes: Domain name extraction unit 121: Used to extract target second-level domain name information that has completed filing and is associated with its own first-level domain name from the domain name configuration list pre-stored in the WeChat mini program backend. The target second-level domain name information includes the second-level domain name address and the corresponding digital certificate validity period.
[0055] Certificate verification unit 122: Communicates with the domain name extraction unit and is used to verify the digital certificate status of the target second-level domain name. By verifying the certificate validity period and signature legality, it confirms that the certificate is valid and has not expired.
[0056] Business matching unit 123: It is connected to the domain name extraction unit 121 and the certificate verification unit 122 respectively. It is used to match and call the target second-level domain name corresponding to the business type based on the business type of the page opening request. The matching relationship between the business type and the second-level domain name is pre-stored in the local configuration file of the WeChat Mini Program, which supports accurate domain name calling in multiple business scenarios.
[0057] In one possible implementation, the page loading module includes: Data verification unit 151: Used to receive third-party web page data forwarded by the proxy server, verify the data format, confirm that the data conforms to the HTML standard format, and filter page data containing malicious code or illegal format.
[0058] iframe verification unit 152: Communicatively connected to data verification unit 151, used to extract the domain name corresponding to the iframe tag when the page data contains an embedded iframe tag, and query the business domain name list in the WeChat Mini Program backend to verify whether the domain name has been configured.
[0059] Rendering feedback unit 153: Communicatively connected to iframe verification unit 152, used to load page data according to preset page rendering rules, and after completing the page layout rendering, to send a page loading completion signal to the main program of WeChat Mini Program, and synchronously record loading time and rendering status information.
[0060] Furthermore, such as Figure 2 As shown, the device 100 for opening a third-party web page using a WeChat Mini Program webview provided in this application includes a request acquisition module 110, a domain name invocation module 120, a request sending module 130, a request forwarding module 140, and a page loading module 150. The request acquisition module 110 is responsible for acquiring the page opening request from the WeChat Mini Program, receiving the third-party web page access instruction triggered by the user, and extracting the core access parameters. The domain name invocation module 120 communicates with the request acquisition module 110 and can match the corresponding second-level domain of its own first-level domain that meets the business requirements from the pre-stored domain name configuration list based on the page opening request. The domain name invocation module 120 further includes a domain name extraction unit 121, which extracts the target second-level domain information that has been filed and is associated with the own first-level domain from the pre-stored domain name configuration list in the WeChat Mini Program backend, including the second-level domain address, digital certificate validity period, a certificate verification unit 122, which verifies the digital certificate status of the target second-level domain, confirming that it is valid and not expired, and a business matching unit 123, which matches and calls the corresponding target second-level domain based on the business type of the page opening request. The request sending module 130 communicates with the domain name calling module 120 to send requests pointing to the second-level domain to the preset proxy server, establishing a compliant communication link. The request forwarding module 140 is deployed in the proxy server and communicates with the request sending module 130 to forward requests pointing to the second-level domain to the corresponding domain address of the third-party web page, completing request data parsing and relaying. The page loading module 150 communicates with the request forwarding module 140 and is integrated into the webview component. It is used to load and display the third-party web page forwarded by the proxy server, realizing page data verification and rendering. This page loading module includes a data verification unit 151, which receives and verifies the third-party web page data forwarded by the proxy server to ensure that it conforms to the HTML standard format and filters malicious or illegal data; an iframe verification unit 152, which extracts the corresponding domain name and verifies whether it has been configured in the business domain name list in the WeChat Mini Program backend when the page data contains embedded iframe tags; and a rendering feedback unit 153, which loads and renders the page data according to preset rules, and sends a loading completion signal to the WeChat Mini Program main program after completion, while synchronously recording the loading time and rendering status information.
[0061] The method and apparatus for opening third-party web pages in WeChat Mini Program WebView of this application can achieve the effect of opening third-party web pages normally by using its own first-level domain to complete WeChat verification and combining second-level domain proxy traffic forwarding. This can be achieved without configuring WeChat verification files on third-party servers. It only relies on the domain name and server held by the technology implementer. First, a second-level domain name is applied for and HTTPS is configured to ensure access security. Then, the first-level domain name is used to complete the Mini Program business domain name verification. Finally, the second-level domain name request is forwarded to the specified path of the third-party page through a proxy server. This allows the WeChat Mini Program WebView to load normally and display the third-party web page.
[0062] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for opening a third-party web page using a WeChat mini-program webview, characterized in that, Includes the following steps: Get the page opening request from the WeChat mini program; Based on the page opening request, call the subdomain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program; The request pointing to the second-level domain name is sent to the preset proxy server; According to the proxy server, requests pointing to the second-level domain are forwarded to the domain address corresponding to the third-party web page; The webview component of the WeChat mini program loads and displays the third-party web page obtained after being forwarded by the proxy server.
2. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, The step of calling the subdomain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program according to the page opening request includes the following steps: Configure the target subdomain information that has been filed and associated with your own primary domain in the WeChat Mini Program backend; The target subdomain information includes the subdomain address and the corresponding digital certificate validity period; Verify the status of the mathematical certificate for the target second-level domain name to confirm that the mathematical certificate is valid and has not expired; Based on the business type of the page opening request, the target subdomain corresponding to the business type is matched and invoked. The matching relationship between the business type and the subdomain is pre-stored in the local configuration file of the WeChat Mini Program.
3. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, Sending the request to the second-level domain to the preset proxy server includes the following steps: Encapsulate the parameters for requests pointing to the aforementioned second-level domain; Establish an encrypted communication connection with the preset proxy server through the HTTPS protocol to verify whether the domain name of the proxy server is consistent with the domain name configuration of the WeChat Mini Program backend and whether it can be accessed normally. The encapsulated request data is sent to the proxy server, and the response returned by the proxy server is received.
4. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, The step of forwarding requests to the second-level domain to the domain address corresponding to the third-party web page according to the proxy server includes the following steps: The proxy server parses the received request data and extracts the domain name address and access path corresponding to the target third-party web page; The proxy server verifies the network connectivity of the subdomain corresponding to the third-party web page and confirms that the subdomain can be accessed normally by sending test data packets. The proxy server forwards the parsed request to the domain address corresponding to the third-party web page according to the original request format, and records the log information of the forwarding request.
5. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, The WeChat Mini Program's webview component loads and displays the third-party web page obtained after being forwarded by the proxy server, including the following steps: The webview component receives third-party web page data forwarded by the proxy server, validates the data format, and confirms that the data conforms to the HTML standard format. If the page data includes an embedded iframe tag, the webview component extracts the domain name corresponding to the iframe tag and verifies whether the domain name has been configured in the business domain name list in the WeChat Mini Program backend. The webview component loads page data according to the preset page rendering, and after completing the page layout rendering, it sends a loading completion signal to the WeChat mini program.
6. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, The process of obtaining the WeChat mini program's page opening request includes the following steps: Parse the page open request and extract the domain name address and page access parameters corresponding to the third-party web page carried in the request; Verify the validity of the page access parameters and filter parameters that contain illegal characters or exceed the preset length.
7. The method for opening a third-party web page using a WeChat mini-program webview according to claim 1, characterized in that, The preprocessing of the proprietary top-level domain name includes the following steps: In the WeChat Mini Program backend, submit a configuration application for your own top-level domain name and upload the qualification certificate documents corresponding to the top-level domain name; Place the domain verification file provided by WeChat in the root directory of the server corresponding to your own top-level domain name to ensure that the WeChat server can access the verification file normally. Upon receiving the primary domain configuration information returned by the WeChat Mini Program backend, the primary domain and its associated secondary domain information are stored in the WeChat Mini Program's local domain list configuration file.
8. A device for opening a third-party web page using a WeChat mini-program webview, characterized in that, include: Request Acquisition Module: Used to acquire page opening requests from WeChat Mini Programs, receive third-party web page access instructions triggered by users, and extract core access parameters from the requests; Domain name invocation module: It communicates with the request retrieval module and is used to invoke the second-level domain corresponding to the self-owned first-level domain that has been configured in the WeChat Mini Program according to the page opening request, and match the target second-level domain that meets the business requirements from the pre-stored domain name configuration list; Request sending module: Communicates with the domain name call module and is used to send requests pointing to the second-level domain name to a preset proxy server, establishing a compliant communication link with the proxy server; Request forwarding module: Deployed in a preset proxy server, it communicates with the request sending module and is used to forward requests pointing to the second-level domain name to the domain name address corresponding to the third-party web page, completing the parsing and relaying of request data; Page loading module: Communicates with the request forwarding module and is integrated into the webview component of the WeChat mini program. It is used to load and display the third-party web page obtained after being forwarded by the proxy server, and to realize the verification and rendering of page data.
9. The device for opening a third-party web page in a WeChat mini-program webview according to claim 8, characterized in that, The domain name invocation module includes: Domain name extraction unit: used to extract target second-level domain name information that has completed filing and is associated with its own first-level domain name from the domain name configuration list pre-stored in the WeChat mini program backend. The target second-level domain name information includes the second-level domain name address and the corresponding digital certificate validity period. Certificate verification unit: Communicatively connected to the domain name extraction unit, used to verify the digital certificate status of the target second-level domain name, and confirm that the certificate is valid and has not expired by verifying the certificate validity period and signature legality; Business matching unit: It is connected to the domain name extraction unit and the certificate verification unit respectively. It is used to match and call the target subdomain corresponding to the business type based on the business type of the page opening request. The matching relationship between the business type and the subdomain is pre-stored in the local configuration file of the WeChat Mini Program, which supports accurate domain name calling in multiple business scenarios.
10. The apparatus for opening a third-party web page using a WeChat mini-program webview according to claim 8, characterized in that, The page loading module includes: Data verification unit: Used to receive third-party web page data forwarded by the proxy server, verify the data format, confirm that the data conforms to the HTML standard format, and filter page data containing malicious code or illegal format; iframe verification unit: Communicates with the data verification unit and is used to extract the domain name corresponding to the iframe tag when the page data contains an embedded iframe tag, and query the business domain name list in the WeChat Mini Program backend to verify whether the domain name has been configured. Rendering Feedback Unit: Communicates with the iframe verification unit and is used to load page data according to preset page rendering rules. After completing the page layout rendering, it sends a page loading completion signal to the main program of the WeChat Mini Program and records the loading time and rendering status information simultaneously.
Citation Information
Patent Citations
Access verification method and device based on server, electronic equipment and storage medium
CN112769802A
Internet access method, terminal and storage medium
WO2013044671A1