CN-121996314-A - Page rendering method, device, equipment and storage medium
Abstract
The embodiment of the invention discloses a page rendering method, a device, equipment and a storage medium, which relate to the technical field of computers, wherein the method can be applied to a native application end and comprises the following steps: intercepting a network request under the condition that the network request for a target page initiated by a calling webpage end of a native application end is detected, and temporarily storing the intercepted network request; based on the received rendering instruction aiming at the target page, executing a temporary network request to acquire page data corresponding to the network request, and sending the page data and the prerendered data of the target page to a webpage end to process the page data and the prerendered data through the webpage end so as to obtain a rendering result of the target page. By adopting the technical scheme of the embodiment of the invention, the service development efficiency can be greatly improved.
Inventors
- GAO WENJIE
- WEN YONGJUN
- Zhu Yuezong
Assignees
- 北京沃东天骏信息技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241108
Claims (13)
- 1. A method for rendering a page, the method being applied to a native application, the method comprising: Intercepting a network request aiming at a target page under the condition that the network request initiated by the original application terminal calling a webpage terminal is detected, and temporarily storing the intercepted network request; based on the received rendering instruction aiming at the target page, executing the temporarily stored network request to acquire page data corresponding to the network request; And sending the page data and the prerendered data of the target page to the webpage end so as to process the page data and the prerendered data through the webpage end and obtain a rendering result of the target page.
- 2. The page rendering method according to claim 1, wherein the temporarily storing the intercepted network request includes: determining whether the target page is in a pre-rendering state; And under the condition that the target page is in the pre-rendering state, temporarily storing the intercepted network request.
- 3. The page rendering method of claim 2, wherein the determining whether the target page is in a pre-rendering state comprises: determining whether each locally stored pre-load data includes the pre-render data; Determining that the target page is in the pre-rendering state when the pre-loading data comprise the pre-rendering data; and determining that the target page is not in the pre-rendering state under the condition that each piece of pre-loading data does not comprise the pre-rendering data.
- 4. The method for rendering a page according to claim 2, wherein, before detecting that the native application terminal invokes a web page terminal to initiate a network request for a target page, the method further comprises: And reconfiguring an interception rule under the condition that an embedded configuration request aiming at the webpage end is received, wherein the reconfigured interception rule comprises the steps of intercepting the network request under the condition that the original application end is detected to call the network request initiated by the webpage end, and temporarily storing the intercepted network request under the condition that the target page is determined to be in the pre-rendering state.
- 5. The page rendering method of claim 2, wherein after the determining whether the target page is in a pre-render state, the method further comprises executing the network request through a native request class if the target page is not in the pre-render state; The method for acquiring the page data corresponding to the network request comprises the steps of executing the network request temporarily stored through the native request class based on the received rendering instruction to acquire the page data corresponding to the network request.
- 6. The method for rendering a page according to claim 1, wherein the sending the page data and the prerendered data of the target page to the web page terminal to process the page data and the prerendered data by the web page terminal to obtain a rendering result of the target page includes: And sending the page data, the prerendering data and the configuration data of the navigation bar of the target page to the webpage end so as to process the page data, the prerendering data and the configuration data through the webpage end to obtain the rendering result.
- 7. The method according to claim 6, wherein before sending the configuration data of the page data, the prerendering data, and the navigation bar of the target page to the web page terminal to process the page data, the prerendering data, and the configuration data by the web page terminal, the method further comprises: under the condition that a loading request for the navigation bar sent by the webpage end is received, intercepting the loading request, and temporarily storing the intercepted loading request; And executing the temporarily stored loading request based on the received rendering instruction so as to acquire the configuration data corresponding to the loading request.
- 8. The method for rendering a page according to claim 7, wherein, in the case of receiving a load request for the navigation bar sent by the web page end, intercepting the load request, and before temporarily storing the intercepted load request, the method further comprises: under the condition that an application starting instruction is received, a communication channel between the original application end and the webpage end is created, and the calling rule of the communication channel is initialized and configured, wherein the calling rule comprises intercepting the loading request and temporarily storing the intercepted loading request under the condition that the webpage end calls the communication channel to send the loading request to the original application end.
- 9. The method according to claim 1, wherein the performing the temporarily stored network request based on the received rendering instruction for the target page to obtain the page data corresponding to the network request includes: Under the condition that the rendering instruction is received, determining whether the network request corresponding to the target page is temporarily stored in a local memory; And under the condition that the network request corresponding to the target page is temporarily stored in the local memory, executing the temporarily stored network request to acquire the page data corresponding to the network request.
- 10. The method for rendering a page according to any one of claims 1 to 9, wherein the performing the temporarily stored network request based on the received rendering instruction for the target page to obtain the page data corresponding to the network request includes: under the condition that the rendering instruction is received, acquiring a resource address carried by the rendering instruction; acquiring the temporarily stored network request, and updating request parameters of the network request based on the resource address; and executing the updated network request to acquire the page data.
- 11. A page rendering device, configured at a native application, the device comprising: The interception module is used for intercepting the network request aiming at the target page under the condition that the network request initiated by the original application terminal calling webpage terminal is detected, and temporarily storing the intercepted network request; the execution module is used for executing the temporarily stored network request based on the received rendering instruction aiming at the target page so as to acquire page data corresponding to the network request; And the rendering module is used for sending the page data and the prerendered data of the target page to the webpage end so as to process the page data and the prerendered data through the webpage end and obtain a rendering result of the target page.
- 12. A page rendering device, characterized in that the page rendering device comprises: One or more processors; a memory for storing one or more programs; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the page rendering method of any of claims 1-10.
- 13. A computer readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements a page rendering method as claimed in any one of claims 1-10.
Description
Page rendering method, device, equipment and storage medium Technical Field The embodiment of the invention relates to the technical field of computers, in particular to a page rendering method, a page rendering device, page rendering equipment and a storage medium. Background Currently, native applications developed based on Hybrid technology can pre-render pages to increase page loading speed before loading fifth generation hypertext markup language (HyperText Markup Language, h 5) pages. In the prior art, in order to ensure timeliness of page data (for example, data acquired by executing a buried point request), a native application end needs to send a non-screen message to a web page end (i.e., an H5 page end) in a pre-rendering stage, so that the web page end does not process a network request of a page, and then, when a user triggers a rendering instruction, the web page end is notified to process the network request. However, in implementing the present invention, it is found that at least the following problems exist in the prior art, if prerendering of an H5 page of a web page end needs to be implemented at a native application end (while timeliness of page data is ensured), an original service logic of the web page end needs to be modified (for example, a listening logic for a non-screen message needs to be added at the web page end). Therefore, each time a native application terminal newly accesses a webpage terminal, the business logic of the newly accessed webpage terminal needs to be modified, and the business development efficiency is extremely low. Disclosure of Invention The embodiment of the invention provides a page rendering method, a device, equipment and a storage medium, which can greatly improve service development efficiency. In a first aspect, the embodiment of the invention provides a page rendering method, which can be applied to a native application terminal, and the method can include intercepting a network request and temporarily storing the intercepted network request under the condition that a network request for a target page, initiated by a native application terminal calling the web terminal, is detected, executing the temporarily stored network request based on a received rendering instruction for the target page to obtain page data corresponding to the network request, and sending the page data and prerendered data of the target page to the web terminal to process the page data and prerendered data through the web terminal so as to obtain a rendering result of the target page. In a second aspect, the embodiment of the invention also provides a page rendering device which can be configured at a native application end, and the device can comprise an interception module, an execution module and a rendering module; The system comprises a target page, an interception module, an execution module and a rendering module, wherein the target page is used for receiving a rendering instruction of the target page, the interception module is used for intercepting a network request and temporarily storing the intercepted network request under the condition that the network request for the target page is detected to be initiated by a native application terminal calling a webpage terminal, the execution module is used for executing the temporarily stored network request based on the received rendering instruction for the target page so as to acquire page data corresponding to the network request, and the rendering module is used for sending the page data and pre-rendering data of the target page to the webpage terminal so as to process the page data and the pre-rendering data through the webpage terminal and obtain a rendering result of the target page. In a third aspect, an embodiment of the present invention provides a page rendering apparatus including: One or more processors; a memory for storing one or more programs; The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the page rendering method as provided by any embodiment of the present invention. In a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a page rendering method as provided by any of the embodiments of the present invention. In a fifth aspect, embodiments of the present invention also provide a computer program product having a computer program stored thereon, which when executed by a processor implements a page rendering method as provided by any of the embodiments of the present invention. The embodiments of the above invention have the following advantages or benefits: In the technical scheme provided by the embodiment of the invention, the business logic of the original application terminal can be modified, and specifically, the modified business logic comprises that the original application terminal can monitor t