Page rendering method and device, equipment and storage medium
By intercepting and processing network requests from the web page on the native application side, the problem of needing to modify the web page logic in existing technologies is solved, achieving efficient web page pre-rendering and improving business development efficiency.
Patent Information
- Application Number
- CN202411596493.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2026-05-08
AI Technical Summary
In existing technologies, in order to pre-render H5 pages on the web application side to ensure the timeliness of page data, it is necessary to modify the business logic on the web application side. This results in the need to modify the logic every time a new web application side is connected, which is inefficient.
The native application intercepts network requests from the web page and executes the temporarily stored network requests when it receives rendering instructions. After obtaining page data and pre-rendered data, it sends them to the web page for processing, avoiding sending "not showing" messages to the web page during the pre-rendering stage. Only the business logic of the native application is modified.
Pre-rendering on the webpage can be implemented without modifying the business logic on the webpage, improving business development efficiency and adapting to pre-rendering functions for newly integrated or already integrated webpages.
Smart Images

Figure CN121996314A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page rendering method, apparatus, device and storage medium. Background Technology
[0002] Currently, native applications developed based on hybrid technology can pre-render pages before loading HyperText Markup Language 5 (H5) pages to improve page loading speed. In existing technologies, to ensure the timeliness of page data (e.g., data obtained through event tracking requests), the native application needs to send a "not display" message to the web page (i.e., the H5 page) during the pre-rendering stage. This prevents the web page from processing network requests for the page temporarily. Later, when the user triggers a rendering command, the web page is notified to process the network request.
[0003] However, in the process of implementing this invention, it was found that the prior art has at least the following problems: In the prior art, if it is necessary to pre-render an H5 page of a webpage on the native application side (while ensuring the timeliness of page data), the original business logic of the webpage needs to be modified (for example, listening logic for off-screen messages needs to be added to the webpage). Thus, whenever a new webpage is connected to the native application side, the business logic of the newly connected webpage needs to be modified, resulting in extremely low business development efficiency. Summary of the Invention
[0004] This invention provides a page rendering method, apparatus, device, and storage medium that can significantly improve business development efficiency.
[0005] In a first aspect, embodiments of the present invention provide a page rendering method that can be applied to native application clients. The method may include: upon detecting a network request initiated by the native application client to a webpage client for a target page, intercepting the network request and temporarily storing the intercepted network request; based on the received rendering instructions for the target page, executing the temporarily stored network request to obtain page data corresponding to the network request; and sending the page data and pre-rendered data of the target page to the webpage client so that the webpage client can process the page data and pre-rendered data to obtain the rendering result of the target page.
[0006] Secondly, embodiments of the present invention also provide a page rendering device that can be configured on a native application. The device may include: an interception module, an execution module, and a rendering module.
[0007] Specifically, the interception module is used to intercept network requests initiated by the native application client to the web client for the target page, and to temporarily store the intercepted network requests; the execution module is used to execute the temporarily stored network requests based on the received rendering instructions for the target page, in order to obtain the page data corresponding to the network requests; the rendering module is used to send the page data and the pre-rendered data of the target page to the web client, so that the web client can process the page data and the pre-rendered data to obtain the rendering result of the target page.
[0008] Thirdly, embodiments of the present invention provide a page rendering device, the page rendering device comprising:
[0009] One or more processors;
[0010] Memory, used to store one or more programs;
[0011] When the one or more programs are executed by the one or more processors, the one or more processors implement the page rendering method provided in any embodiment of the present invention.
[0012] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the page rendering method provided in any embodiment of the present invention.
[0013] Fifthly, embodiments of the present invention also provide a computer program product having a computer program stored thereon, which, when executed by a processor, implements the page rendering method provided in any embodiment of the present invention.
[0014] The embodiments of the above invention have the following advantages or beneficial effects:
[0015] In the technical solution provided by this invention, the business logic of the native application can be modified. Specifically, the modified business logic includes: the native application can monitor its own calls to the web page; when it detects that it is initiating a network request to a certain H5 page (i.e., the target page in this embodiment), it can intercept the network request and temporarily store it so that the web page cannot process it normally; then, when the user triggers a rendering instruction for the target page, the native application can execute the previously stored network request and send the page data corresponding to the network request, as well as the pre-rendered data for the target page obtained in the pre-rendering stage, to the web page, so that the web page can process the page data and the pre-rendered data to obtain the rendering result of the target page. Since in the prior art, network requests initiated by the web page are initiated under the call of the native application, the native application can intercept network requests by monitoring its own calls to the web page. Because the native application can intercept network requests, it doesn't need to send a "not displayed" message to the webpage during the pre-rendering stage. Therefore, the webpage doesn't need to listen for these messages, allowing it to ignore network requests before actual rendering. Furthermore, since the native application executes the temporary network request itself after receiving the rendering command, it also doesn't need to send a "displayed" message to the webpage to notify it to process the network request, eliminating the need for the webpage to listen for these messages. Additionally, because the H5 page rendering process must be performed on the webpage, the native application, after executing the temporary network request, needs to send the obtained page data and pre-rendered data to the webpage for rendering (this process only modifies the native application's business logic, adding the logic to send a rendering request carrying the page data and pre-rendered data to the webpage at this point; the webpage then processes the rendering request normally). As can be seen, this embodiment of the invention does not require modification to the original business logic on the web page (including the elimination of the need to add listening logic for mismatched and displayed messages on the web page). Only a single modification to the business logic on the native application side is required to achieve pre-rendering of the H5 page on the web page on the native application side while ensuring the timeliness of page data. Thus, after modifying the business logic on the native application side, whether it's adding pre-rendering functionality for newly integrated web pages or for existing integrated web pages, no modification to the business logic on the web page is necessary. Therefore, this embodiment of the invention can significantly improve business development efficiency by modifying the business logic on the native application side. Attached Figure Description
[0016] Figure 1This is a flowchart illustrating a page rendering method provided in an embodiment of the present invention;
[0017] Figure 2 This is a flowchart illustrating another page rendering method provided in an embodiment of the present invention;
[0018] Figure 3 This is a flowchart illustrating another page rendering method provided in an embodiment of the present invention;
[0019] Figure 4 This is a simplified flowchart illustrating a page rendering method provided in an embodiment of the present invention;
[0020] Figure 5 This is a simplified flowchart illustrating another page rendering method provided in an embodiment of the present invention;
[0021] Figure 6 This is a schematic diagram of the structure of a page rendering device provided in an embodiment of the present invention;
[0022] Figure 7 This is a schematic diagram of the structure of a page rendering device provided in an embodiment of the present invention. Detailed Implementation
[0023] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0024] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0025] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of the embodiments of the present invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0026] It should be noted that in the embodiments of the present invention, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or explanation. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of the present invention should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0027] In the description of the embodiments of the present invention, unless otherwise stated, "a plurality of" or "each" means two or more.
[0028] Figure 1 This is a flowchart illustrating a page rendering method provided in an embodiment of the present invention. This method is applicable to application scenarios where native applications pre-render H5 pages. The method can be executed by a page rendering device provided in this embodiment of the invention. This device can be implemented in software and / or hardware and integrated into a page rendering device.
[0029] The page rendering method provided in this embodiment of the invention can be applied to page rendering systems including native application clients and multiple web page clients. Specifically, the page rendering device executing this method can be configured on the native application client. Correspondingly, the page rendering device integrating the page rendering device can be the corresponding device on the native application client, such as the server of the native application client.
[0030] It should be noted that the native application involved in the embodiments of the present invention is specifically a native application (APP) developed based on Hybrid technology. This native application can load H5 pages from the web page through the WebView component.
[0031] In addition, in this embodiment of the invention, the interaction process between the native application and each webpage in the page rendering system is exactly the same. In the following description of this embodiment of the invention, the interaction process between the native application and one of the webpages will be used as an example.
[0032] like Figure 1 As shown, the page rendering method provided in this embodiment of the invention specifically includes the following steps:
[0033] S110. When a network request for a target page is detected initiated by the native application calling the web page, the network request is intercepted and temporarily stored.
[0034] In existing technologies, the process of a native application calling a WebView component to load an H5 page from a webpage can be roughly divided into three stages: application startup, pre-rendering, and on-screen display. During application startup, the native application can obtain pre-rendering configuration information and then listen for the pre-rendering timing of each H5 page based on this information. Once the pre-rendering timing of a particular H5 page is triggered, the application can enter the pre-rendering stage for that H5 page. During the pre-rendering stage, the pre-rendering environment can be initialized. For example, the initialization process may include creating a WebView container in the background and initializing it. Then, pre-rendering loading can be performed within the WebView container. This pre-rendering loading process may include downloading the HTML, JavaScript (an interpreted scripting language), and Cascading Style Sheets (CSS) files for the H5 page, parsing and executing the JS and Document Object Model (DOM) files, and finally caching the pre-rendered data (i.e., the WebView container loaded in the background) in memory. During the parsing and execution of JS and DOM files, the native application can call the web page based on the parsed data. The web page then initiates a network request based on this data. After initiating the network request, the native application sends a "not display" message to the web page, informing it not to process the request temporarily. When a user triggers the rendering command for the H5 page (e.g., by clicking the page's entry point), the H5 page enters the display stage. During this stage, the native application can send a display message to the web page, which may contain pre-rendered data cached in the pre-rendering stage. Upon receiving this message, the web page can process the previously unprocessed network request and then render the H5 page based on the pre-rendered data and the page data obtained from processing the network request.
[0035] In this embodiment of the invention, the business logic of a native application calling a WebView component to load an H5 page from a webpage in the prior art has been modified. The business logic during the application startup phase remains consistent with the prior art, while the business logic during the pre-rendering and on-screen stages has been modified. Specifically, the modification to the pre-rendering stage includes: after the native application initiates a network request to the webpage, it no longer sends an on-screen-not-send message to the webpage; instead, it intercepts the network request and temporarily stores it. Furthermore, since the native application needs to intercept the network request after initiating it, it must monitor its own calls to the webpage to intercept the network request when it detects that it is initiating a network request to a specific H5 page (i.e., the target page in this embodiment).
[0036] In one possible implementation, network requests can be API call requests, event tracking requests, etc. API call requests are used to invoke data service interfaces to retrieve corresponding page data; for example, a data service interface can be invoked to access a table to obtain the real-time value of a specified field, which becomes a component of the target page. Event tracking requests are used to statistically analyze certain user behavior data; for example, event tracking requests can be used to count the cumulative number of times users access the target page from the native application.
[0037] Furthermore, in this embodiment of the invention, the native application can intercept network requests using an interceptor. For example, taking iOS (an operating system) as an example, network requests can be intercepted using WKURLSchemeHandle (a request interceptor).
[0038] After the native application intercepts the network request, it can cache the request parameters (such as the request path, request headers, request body, etc.) in local memory. When it is displayed on the screen, the network request is retrieved from local memory and executed again.
[0039] S120. Based on the received rendering instructions for the target page, execute the temporarily stored network request to obtain the page data corresponding to the network request.
[0040] The modification to the on-screen display stage in this embodiment of the invention may include: after the user triggers the rendering instruction of the target page, the native application no longer sends an on-screen display message to the web page, but instead executes the previously stored network request itself. Taking an API call request as an example, the native application can call the corresponding data service interface by executing the stored API call request to obtain the real-time field value of a specified field in a table. This real-time field value is then the obtained page data. Rendering this page data can yield some elements that make up the target page.
[0041] Rendering instructions can be commands triggered by user actions within the native application's interface. For example, the native application's interface provides a page entry control for accessing a target page. After the user clicks or long-presses this page entry control, the native application will receive a rendering instruction for that target page and enter the page loading stage.
[0042] Optionally, based on the received rendering instructions for the target page, a temporary network request is executed to obtain the page data corresponding to the network request, including: upon receiving the rendering instructions, obtaining the resource address carried by the rendering instructions; obtaining the temporary network request and updating the request parameters of the network request based on the resource address; and executing the updated network request to obtain the page data.
[0043] The resource address can be the Uniform Resource Locator (URL) address of the target page. For example, when the native application receives a rendering instruction from the target page, it can obtain the URL address carried by the rendering instruction, and then replace the URL part in the request parameters of the previously stored network request with the URL address carried by the rendering instruction to obtain an updated network request, which is then executed.
[0044] In practical applications, the request parameters of network requests initiated during the pre-rendering stage and the formal network requests during the on-screen stage (i.e., requests triggered by rendering instructions) may be inconsistent. When the request parameters of the two requests are inconsistent, if the native application directly executes the network requests temporarily stored during the pre-rendering stage, execution failure or errors may occur. For example, after the pre-rendering stage and before the on-screen stage, business personnel may make changes to a certain business, such as modifying the access path of a data service interface. In this case, if the native application directly executes the temporarily stored network requests during the on-screen stage, it will obtain the wrong page number or fail to obtain page data due to an incorrect access path. Based on this, in this embodiment of the invention, before executing the temporarily stored network requests, the native application can update the request parameters of the temporarily stored network requests based on the latest resource address obtained during the on-screen stage, and then execute the updated network requests. This can avoid network request execution failure or errors caused by inconsistencies in request parameters between the pre-rendering stage and the on-screen stage.
[0045] S130. Send the page data and the pre-rendered data of the target page to the web page so that the web page can process the page data and the pre-rendered data to obtain the rendering result of the target page.
[0046] The pre-rendered data refers to the WebView container that is loaded in the background during the pre-rendering stage.
[0047] Since the rendering process of an H5 page needs to be executed on the webpage, the native application, after completing the temporary network request, needs to send the obtained page data and pre-rendered data to the webpage for rendering. Therefore, in this embodiment of the invention, the modification to the on-screen stage further includes: after completing the network request, the native application sends a rendering request carrying page data and pre-rendered data to the webpage. It should be noted that this modification only changes the business logic of the native application, adding the logic to send the rendering request to the webpage at this time, while the webpage simply processes the rendering request sent by the native application normally. The specific process of the webpage rendering page data and pre-rendered data can be found in the relevant descriptions of existing technologies, and will not be repeated here.
[0048] In the page rendering method provided by this invention, the business logic of the native application can be modified. Specifically, the modified business logic includes: the native application can monitor its own calls to the webpage. When it detects that it is initiating a network request to a certain H5 page (i.e., the target page in this invention), it can intercept the network request and temporarily store it so that the webpage cannot process it normally. Then, when the user triggers a rendering instruction for the target page, the native application can execute the previously stored network request and send the page data corresponding to the network request, as well as the pre-rendered data for the target page obtained in the pre-rendering stage, to the webpage. The webpage then processes the page data and the pre-rendered data to obtain the rendering result of the target page. Since in the prior art, network requests initiated by the webpage are initiated under the call of the native application, the native application can intercept network requests by monitoring its own calls to the webpage. Because the native application can intercept network requests, it doesn't need to send a "not displayed" message to the webpage during the pre-rendering stage. Therefore, the webpage doesn't need to listen for these messages, allowing it to ignore network requests before actual rendering. Furthermore, since the native application executes the temporary network request itself after receiving the rendering command, it also doesn't need to send a "displayed" message to the webpage to notify it to process the network request, eliminating the need for the webpage to listen for these messages. Additionally, because the H5 page rendering process must be performed on the webpage, the native application, after executing the temporary network request, needs to send the obtained page data and pre-rendered data to the webpage for rendering (this process only modifies the native application's business logic, adding the logic to send a rendering request carrying the page data and pre-rendered data to the webpage at this point; the webpage then processes the rendering request normally). As can be seen, this embodiment of the invention does not require modification to the original business logic on the web page (including the elimination of the need to add listening logic for mismatched and displayed messages on the web page). Only a single modification to the business logic on the native application side is required to achieve pre-rendering of the H5 page on the web page on the native application side while ensuring the timeliness of page data. Thus, after modifying the business logic on the native application side, whether it's adding pre-rendering functionality for newly integrated web pages or for existing integrated web pages, no modification to the business logic on the web page is necessary. Therefore, this embodiment of the invention can significantly improve business development efficiency by modifying the business logic on the native application side.
[0049] Reference Figure 2This is a flowchart illustrating another page rendering method provided in an embodiment of the present invention. The method in this embodiment can be combined with various optional schemes in the page rendering methods provided in the foregoing embodiments, further optimizing the page rendering methods provided in the foregoing embodiments. Figure 2 As shown, the specific steps include:
[0050] S210. If a network request for a target page is detected, initiated by the native application calling the web page, the network request will be intercepted.
[0051] Optionally, before intercepting a network request initiated by the native application client to the web client for a target page, the page rendering method provided in this embodiment of the invention further includes: reconfiguring the interception rules upon receiving an embedding configuration request for the web client.
[0052] The reconfigured interception rules include: intercepting network requests initiated by the native application calling the web page, and temporarily storing the intercepted network requests if the target page is determined to be in a pre-rendering state.
[0053] In one possible implementation, the native application can maintain a list of web pages with pre-rendering capabilities that have been integrated into the application. Correspondingly, the modified business logic of the native application can also include: before intercepting a network request, determining whether the request originates from a specified web page; if so, intercepting it; otherwise, not intercepting it. The specified web pages are those maintained in the integration configuration list, which may include identifiers for web pages with pre-rendering capabilities. For example, when a business user needs to add pre-rendering functionality to a web page (which could be a newly integrated web page or an existing web page without pre-rendering capabilities), they can trigger an embedding configuration request for that web page through the embedding configuration interface of the native application (e.g., by entering the web page's identifier in the embedding configuration interface). The native application can then respond to this embedding configuration request by adding the web page's identifier to the integration configuration list.
[0054] In this embodiment of the invention, the native application can simultaneously access multiple web pages. After modifying the business logic of the pre-rendering stage of the native application, the native application will intercept all network requests initiated by the web pages. However, some of these web pages may not have pre-rendering capabilities. If the same processing logic is applied to web pages with and without pre-rendering capabilities, it will affect the business processing efficiency of the web pages without pre-rendering capabilities (because the step of intercepting and then analyzing network requests is added, thus affecting business processing efficiency). Therefore, in this embodiment of the invention, when modifying the business logic of the pre-rendering stage of the native application, the native application can also be restricted to intercepting network requests according to interception rules. Specifically, the interception rule could be to intercept only network requests initiated by web pages maintained in the access configuration list.
[0055] S220. Determine whether the target page is in a pre-rendering state.
[0056] In one possible implementation, the rendering status of each H5 page on the webpage can be maintained in a rendering status list. After intercepting network requests for the target page, the rendering status of the target page can be viewed in the rendering status list to determine whether the target page is in a pre-rendering state. For example, during the application startup phase, the pre-rendering configuration information obtained by the native application may include a rendering status list. At this time, the rendering status of each H5 page in the rendering status list is in an unrendered state. After the pre-rendering timing of the target page in each H5 page is detected to be triggered, the pre-rendering stage of the target page can be entered, and the rendering status of the target page in the rendering status list is adjusted to the pre-rendering state. Afterwards, after obtaining the rendering result of the target page, the rendering status of the target page in the rendering status list is adjusted to the rendering completed state.
[0057] Optionally, determining whether the target page is in a pre-rendered state includes: determining whether each preloaded data in local storage includes pre-rendered data; if each preloaded data includes pre-rendered data, determining that the target page is in a pre-rendered state; if each preloaded data does not include pre-rendered data, determining that the target page is not in a pre-rendered state.
[0058] Since the native application caches the pre-rendered data during the pre-rendering stage, in this embodiment of the invention, the native application can also determine whether the target page is currently in a pre-rendering state by checking whether the locally cached pre-loaded data includes the pre-rendered data corresponding to the target page. This eliminates the need to maintain a separate rendering state list, simplifying business processing logic.
[0059] S230. When the target page is in a pre-rendered state, temporarily store the intercepted network requests.
[0060] S240. Based on the received rendering instructions for the target page, execute the temporarily stored network request to obtain the page data corresponding to the network request.
[0061] Optionally, after determining whether the target page is in a pre-rendering state, the page rendering method provided in this embodiment of the invention further includes: if the target page is not in a pre-rendering state, executing a network request through a native request class; correspondingly, based on the received rendering instructions for the target page, executing a temporarily stored network request to obtain the page data corresponding to the network request, including: based on the received rendering instructions, executing a temporarily stored network request through a native request class to obtain the page data corresponding to the network request.
[0062] Taking iOS as an example, native applications can use NSURLRequest (iOS's native network request class) to perform network requests. For instance, a native application can create an NSURLRequest object using a URL address and then use that object to perform a network request.
[0063] In this embodiment of the invention, whether executing network requests corresponding to pre-rendering services or other services (such as normal direct rendering services), both can be performed using native request classes. This eliminates the need to modify business logic on the webpage, enabling the execution of temporary network requests for pre-rendering services and network requests for other services on the native application side, ensuring the normal operation of both pre-rendering and other services.
[0064] Optionally, based on the received rendering instructions for the target page, a temporary network request is executed to obtain the page data corresponding to the network request, including: upon receiving the rendering instructions, determining whether a network request corresponding to the target page is temporarily stored in local memory; if a network request corresponding to the target page is temporarily stored in local memory, executing the temporary network request to obtain the page data corresponding to the network request.
[0065] Because pre-rendering and normal rendering (in this embodiment, rendering services other than pre-rendering) are coupled in existing technologies, after modifying the business logic of the native application's on-screen display stage, the rendering instructions received by the native application can be for both pre-rendered and non-pre-rendered pages. For non-pre-rendered pages, the native application does not cache the corresponding network request in its local memory. Therefore, in this embodiment, upon receiving a rendering instruction for a page, it can further determine whether a network request corresponding to that page exists in local memory. If a network request corresponding to that page exists in local memory, it indicates that the pre-rendered resources for that page are stored in local memory, meaning the page is pre-rendered and the previously stored network request can be executed. This ensures the normal operation of the normal rendering service, thereby ensuring the normal operation of the native application.
[0066] Furthermore, it should be noted that in practical applications, the native application can simultaneously process network requests and rendering instructions from multiple pages. That is, for a specific network request from the same page, the native application may also be involved in processing network requests from other pages throughout the entire lifecycle of processing that network request. Therefore, the native application is unaware of which page the currently received processing task originates from at each stage (e.g., the on-screen stage). Thus, for network requests from the same page, the native application may perform the same logical processing on them at multiple processing stages to determine the rendering state of the currently processed page. For example, after receiving a network request from the target page, a pre-rendering state check can be performed on the target page; after receiving a rendering instruction from the target page, another pre-rendering state check can be performed on the target page.
[0067] S250: Send the page data and the pre-rendered data of the target page to the web page so that the web page can process the page data and the pre-rendered data to obtain the rendering result of the target page.
[0068] In this embodiment of the invention, based on the foregoing embodiments, since pre-rendering services and normal rendering services are coupled in the prior art, after modifying the business logic of the native application, the network requests intercepted by the native application may not only be network requests corresponding to the pre-rendering service, but also network requests corresponding to other services (such as normal direct rendering services). Thus, if the native application intercepts all monitored network requests and temporarily suspends their execution, other services will malfunction. Therefore, in this embodiment of the invention, after intercepting network requests, it can be further determined whether the target page is in a pre-rendering state. If it is determined that the target page is in a pre-rendering state, the network request is temporarily stored; if it is determined that the target page is not in a pre-rendering state, the network request can be processed normally. This ensures the normal operation of the normal rendering service, thereby ensuring the normal operation of the native application.
[0069] It should be noted that the page rendering method proposed in the embodiments of the present invention and the foregoing embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the foregoing embodiments, and the beneficial effects of the foregoing embodiments are also applicable in this embodiment.
[0070] Reference Figure 3 This is a flowchart illustrating another page rendering method provided in an embodiment of the present invention. The method in this embodiment can be combined with various optional schemes in the page rendering methods provided in the foregoing embodiments, further optimizing the page rendering methods provided in the foregoing embodiments. Figure 3 As shown, the specific steps include:
[0071] S310. When a network request for a target page is detected initiated by the native application calling the web page, the network request is intercepted and temporarily stored.
[0072] S320: Based on the received rendering instructions for the target page, execute the temporarily stored network request to obtain the page data corresponding to the network request.
[0073] S330: Send the page data, pre-rendered data, and navigation bar configuration data of the target page to the web page so that the web page can process the page data, pre-rendered data, and configuration data to obtain the rendering result.
[0074] The configuration data for the navigation bar of the target page can be the data required when rendering the navigation bar of the target page.
[0075] Optionally, before sending page data, pre-rendered data, and the navigation bar configuration data of the target page to the web page for processing of the page data, pre-rendered data, and configuration data to obtain the rendering result, the page rendering method provided in this embodiment of the invention further includes: upon receiving a loading request for the navigation bar sent by the web page, intercepting the loading request and temporarily storing the intercepted loading request; and executing the temporarily stored loading request based on the received rendering instruction to obtain the configuration data corresponding to the loading request.
[0076] The loading request can be a request initiated by the webpage based on the parsed data generated during the pre-rendering phase when the native application parses and executes JS and DOM files. Specifically, the loading request is used to request the configuration data needed to render the navigation bar.
[0077] Since the rendering process may also require navigation bar configuration data, the modifications to the pre-rendering stage in this embodiment of the invention may further include: when the native application receives a loading request for the navigation bar sent by the web page, it intercepts the loading request and temporarily stores the intercepted loading request; correspondingly, the modifications to the on-screen stage in this embodiment of the invention may further include: when the rendering instruction of the current page is received, the temporarily stored loading request is executed to obtain the corresponding configuration data.
[0078] Optionally, before intercepting and temporarily storing the loading request sent by the web page for the navigation bar, the page rendering method provided in this embodiment of the invention further includes: upon receiving an application startup instruction, creating a communication channel between the native application and the web page, and initializing the calling rules of the communication channel.
[0079] The invocation rules include intercepting and temporarily storing loading requests sent from the web page to the native application via a communication channel. The application launch command can be an instruction automatically triggered by the native application upon entering the launch phase; for example, it could be an instruction triggered after the user clicks on the application icon or performs other selection actions.
[0080] In one possible implementation, the communication channel between the native application and the web page can be a JSBridge (a JS-based bridge). In this embodiment of the invention, a JSBridge method that can be called by the web page can be predefined on the native application. When the web page sends a loading request to the native application, it can do so by calling the JSBridge method.
[0081] As can be seen, this embodiment of the invention enables the web client to call methods provided by the native application client by creating a communication channel. Since the navigation bar configuration data is ultimately obtained locally by the native application client, the web client can send a loading request to the native application client through this communication channel during the pre-rendering stage to request the corresponding configuration data. Furthermore, to ensure the timeliness of the configuration data, this embodiment of the invention also intercepts and temporarily stores the loading request during the pre-rendering stage, and then processes the temporarily stored loading request during the on-screen display stage.
[0082] In this embodiment of the invention, based on the foregoing embodiments, since in the prior art, for some H5 pages, the configuration data of their navigation bar needs to be obtained locally by the native application, rather than by the web page through network requests, the rendering request sent by the native application to the web page during the on-screen stage can carry not only page data and pre-rendered data, but also the configuration data of the target page's navigation bar.
[0083] It should be noted that the page rendering method proposed in the embodiments of the present invention and the foregoing embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the foregoing embodiments, and the beneficial effects of the foregoing embodiments are also applicable in this embodiment.
[0084] To more clearly describe the modified business logic of the original application in this embodiment of the invention, please refer to... Figure 4 This is a simplified flowchart illustrating a page rendering method provided in an embodiment of the present invention. Figure 4 As shown, users can trigger the application launch command by clicking the application icon or performing other selection operations. Upon receiving the launch command, the native application starts launching. Then, the native application can begin pre-rendering the page. During pre-rendering, a WebView container needs to be created and initialized, and pre-rendered data is loaded within the WebView container. The parsed data is then sent to the web page. The web page can execute JavaScript code logic based on the received data and initiate network requests. The native application can intercept these network requests and determine if the page is in a pre-rendering state. If it is not in a pre-rendering state, it indicates that normal rendering is currently being processed, and the native application can directly execute the network request and send the page data obtained from the network request to the web page for rendering. If it is in a pre-rendering state, it indicates that pre-rendering is currently being processed, and the native application can temporarily store the network request locally. Once the user actually clicks on the page, the data loaded during the pre-rendering stage can be displayed on the screen, and the stored network request can be retrieved, its request parameters updated, and then the updated network request executed.
[0085] It should be noted that the page rendering method proposed in the embodiments of the present invention and the foregoing embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the foregoing embodiments, and the beneficial effects of the foregoing embodiments are also applicable in this embodiment.
[0086] To more clearly describe the technical solution for modifying business logic on the native application side provided by the embodiments of the present invention, the page rendering process of the embodiments of the present invention will be described in detail below.
[0087] Reference Figure 5 This is a simplified flowchart illustrating a page rendering method provided in an embodiment of the present invention. Figure 5 As shown, after a user clicks on the native application, the native application enters the application startup phase. During this phase, the native application can listen for the pre-rendering timing of each page based on pre-rendering configuration information. If the pre-rendering timing of a certain page is triggered, the application can enter the pre-rendering phase for that page. Specifically, the business logic of the application startup phase is the same as in existing technologies, and can be found in the relevant descriptions of existing technologies; these will not be repeated here.
[0088] In this embodiment of the invention, the pre-rendering stage may include two sub-stages: pre-rendering initialization and pre-rendering loading. The pre-rendering initialization sub-stage may include the following steps:
[0089] S5210: The native application determines whether the pre-rendering function is enabled based on the pre-rendering configuration information, determines whether the number of pre-rendering times has reached the maximum number of pre-rendering times, and verifies the URL address.
[0090] If it is confirmed that the pre-rendering function is enabled, the number of pre-rendering attempts has not reached the maximum number of pre-rendering attempts, and the URL address verification is successful, then S5220 can continue to be executed; otherwise, pre-rendering processing will not be performed.
[0091] S5220: The native application determines whether pre-rendered data for the page already exists.
[0092] If it exists, pre-rendering will not be performed; otherwise, S5230 can continue to be executed.
[0093] It should be noted that the generation and consumption of pre-rendered data are matched one-to-one (i.e., the generated pre-rendered data can only be used for one rendering process). In practical applications, the following situation may occur: when a user enters page A from the homepage, the pre-rendering time of page B is triggered, and the pre-rendered data of page B is obtained. However, the user does not click on page B in page A and returns to the homepage. In this case, when the user enters page A again from the homepage, the pre-rendered data of page B obtained last time has not been consumed. That is, the native application still has the pre-rendered data of page B. Therefore, in this case, pre-rendering processing can be omitted.
[0094] S5230: The native application creates a WebView container in the background and initializes it.
[0095] S5240: The native application creates a communication channel (e.g., a JSBridge) for communication between the native application and the web page, and initializes the calling rules for the communication channel.
[0096] Specifically, the rules for calling the communication channel can be configured as follows: when the web page sends a loading request to the native application through the communication channel (i.e., executes the JSBridge method), the native application can intercept the loading request and determine whether the page is in the pre-rendering stage (corresponding to...). Figure 5 The judgment box following the communication channel indicates that if the process is in the pre-rendering stage, the loading request will be temporarily stored; otherwise, the loading request will be executed normally.
[0097] S5250: The native application enables the function of intercepting network requests (for example, the interception function implemented by S5250 corresponds to S210 in the aforementioned embodiment).
[0098] Specifically, the network request interception function can monitor its own calls to web pages. When it detects that it is making a network request to a web page (e.g., ...), it will intercept the request. Figure 5 When making API calls or data tracking requests, network requests can be intercepted using an interceptor.
[0099] S5260, after intercepting network requests, can determine whether the page is in the pre-rendering stage (corresponding to...). Figure 5 The decision box following the interceptor. For example, S5260 corresponds to S220 in the aforementioned embodiment.
[0100] If the process is in the pre-rendering stage, the network request is temporarily stored (for example, this step corresponds to S230 in the aforementioned embodiment); if the process is not in the pre-rendering stage, the network request is executed using the native request class.
[0101] After the pre-render initialization sub-stage is completed, the pre-render loading sub-stage can proceed. The pre-render loading sub-stage may include the following steps:
[0102] S5270: The native application client concatenates parameters in the URL address and adds a rendering (xrender) parameter to indicate that the URL address is the page address of the pre-rendered business.
[0103] S5280, Start loading the URL page by loading and processing the URL address with the xrender identifier in the WebView container created in the pre-render initialization sub-stage.
[0104] S5290: The native application downloads HTML, JS, CSS and other files of the page in WebView, and parses and executes JS and DOM files. In addition, during the parsing and execution of JS and DOM files, the native application can call the web page based on the parsed data, and the web page can initiate network requests and loading requests based on the parsed data.
[0105] When S52100 executes a network request, it will be intercepted by the business logic implemented in S5250, and S5250 will be executed.
[0106] When S52110 executes the loading request, it will be intercepted by the business logic implemented in S5240.
[0107] S52120: The native application caches the pre-rendered data (i.e. the WebView container loaded in the background) in memory. When caching, the URL address of the page can be used as the key.
[0108] After the pre-rendering loading sub-stage is completed, the system can proceed to the on-screen display stage in response to user clicks. The on-screen display stage may include the following steps:
[0109] S5310: When a user clicks the page entry point, the native application executes page initialization and WebView container initialization. Before executing WebView container initialization, the route redirects to the judgment logic, specifically checking whether a loaded WebView container is cached locally (corresponding to...). Figure 5 (The conditional statement that follows the redirection from the middle router).
[0110] If it is determined that no fully loaded WebView container is cached (i.e., no network request corresponding to the target page is stored, or in other words, no pre-rendered resources corresponding to the target page are stored), then the WebView container initialization is performed normally, and data is loaded normally within the WebView container. If it is determined that a fully loaded WebView container is cached, then the WebView container that was loaded during the pre-rendering stage is directly retrieved, pre-rendered and displayed, and then the process proceeds to S5320.
[0111] S5320: The native application obtains a temporarily stored loading request and executes it. Then, it sends the obtained configuration data to the web page, which updates the navigation bar. Simultaneously, the native application obtains a temporarily stored network request, updates the request parameters, executes the updated network request, and sends a rendering request carrying page data to the web page. For example, S5320 corresponds to S240 in the aforementioned embodiment.
[0112] S5230, Rendering Processing: The web page performs rendering processing based on the data sent by the native application. For example, this step corresponds to S250 in the aforementioned embodiment.
[0113] It should be noted that, Figure 5 The key processing steps are illustrated, but the complete rendering process is not shown.
[0114] Figure 6 This is a schematic diagram of the structure of a page rendering device provided in an embodiment of the present invention. The device can be configured on a native application and may include: an interception module 710, an execution module 720, and a rendering module 730.
[0115] Specifically, the interception module 710 is used to intercept network requests initiated by the native application client to the web client for the target page, and to temporarily store the intercepted network requests; the execution module 720 is used to execute the temporarily stored network requests based on the received rendering instructions for the target page, so as to obtain the page data corresponding to the network requests; the rendering module 730 is used to send the page data and the pre-rendered data of the target page to the web client, so that the web client can process the page data and the pre-rendered data to obtain the rendering result of the target page.
[0116] Optionally, in one possible implementation, the interception module 710 is specifically used for:
[0117] Determine whether the target page is in a pre-rendered state; if the target page is in a pre-rendered state, temporarily store the intercepted network requests.
[0118] Optionally, in another possible implementation, the interception module 710 is further configured to:
[0119] Determine whether each preloaded data in local storage includes pre-rendered data;
[0120] If the preloaded data includes pre-rendered data, the target page is determined to be in a pre-rendered state; if the preloaded data does not include pre-rendered data, the target page is determined not to be in a pre-rendered state.
[0121] Optionally, in another possible implementation, the page rendering apparatus provided in this embodiment of the invention further includes a configuration module; the configuration module is used for:
[0122] Before intercepting a network request initiated by the native application client calling the web client for the target page, the interception module 710 reconfigures the interception rules upon receiving an embedding configuration request for the web client. The reconfigured interception rules include: intercepting the network request when the native application client calls the web client, and temporarily storing the intercepted network request when it is determined that the target page is in a pre-rendering state.
[0123] Optionally, in another possible implementation, the execution module 720 is further configured to: after the interception module 710 determines whether the target page is in a pre-rendered state, execute a network request through a native request class if the target page is not in a pre-rendered state;
[0124] The execution module 720 is also used to: execute the temporarily stored network request through the native request class based on the received rendering instructions, so as to obtain the page data corresponding to the network request.
[0125] Optionally, in another possible implementation, the rendering module 730 is specifically used to: send page data, pre-rendered data, and configuration data of the navigation bar of the target page to the web page, so that the web page can process the page data, pre-rendered data, and configuration data to obtain the rendering result.
[0126] Optionally, in another possible implementation, the interception module 710 is further configured to: before the rendering module 730 sends the page data, pre-rendered data, and configuration data of the navigation bar of the target page to the web page so that the web page can process the page data, pre-rendered data, and configuration data to obtain the rendering result, intercept the loading request for the navigation bar sent by the web page and temporarily store the intercepted loading request.
[0127] The execution module 720 is also used to execute a temporarily stored loading request based on the received rendering instructions in order to obtain the configuration data corresponding to the loading request.
[0128] Optionally, in another possible implementation, the page rendering apparatus provided in this embodiment of the invention further includes a creation module;
[0129] A creation module is used to intercept the loading request sent by the web page for the navigation bar when the interception module 710 receives it, and before temporarily storing the intercepted loading request, create a communication channel between the native application and the web page when the application startup command is received, and initialize the calling rules of the communication channel; wherein, the calling rules include, when the web page calls the communication channel to send a loading request to the native application, intercepting the loading request and temporarily storing the intercepted loading request.
[0130] Optionally, in another possible implementation, the execution module 720 is specifically used for:
[0131] Upon receiving a rendering instruction, determine whether there is a network request corresponding to the target page temporarily stored in local memory;
[0132] If a network request corresponding to the target page is temporarily stored in local memory, the temporary network request is executed to obtain the page data corresponding to the network request.
[0133] Optionally, in another possible implementation, the execution module 720 is specifically used for:
[0134] Upon receiving a rendering instruction, obtain the resource address carried by the rendering instruction; obtain the temporary network request and update the request parameters of the network request based on the resource address; execute the updated network request to obtain page data.
[0135] The page rendering apparatus provided in this embodiment of the invention belongs to the same inventive concept as the page rendering methods provided in the foregoing embodiments. For details not described in detail in the embodiments of the page rendering apparatus, please refer to the relevant content of the foregoing method embodiments. The corresponding beneficial effects can also be referred to the beneficial effect analysis of the foregoing method embodiments.
[0136] Figure 7 This is a schematic diagram of the structure of a page rendering device provided in an embodiment of the present invention. Figure 7 A block diagram is shown of an exemplary page rendering device 12 suitable for implementing embodiments of the present invention. Figure 7 The page rendering device 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0137] like Figure 7 As shown, the page rendering device 12 is represented in the form of a general-purpose computing device. The components of the page rendering device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and a bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0138] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0139] Page rendering apparatus 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by page rendering apparatus 12, including volatile and non-volatile media, removable and non-removable media.
[0140] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory (i.e., Figure 7 (High-speed cache in the middle). Page rendering device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 Not shown; usually referred to as a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0141] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0142] The page rendering device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with the page rendering device 12, and / or with any device that enables the page rendering device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through the input / output (I / O) interface 22. Furthermore, the page rendering device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via the network adapter 20. Figure 7 As shown, network adapter 20 communicates with other modules of page rendering device 12 via bus 18. It should be understood that, although... Figure 7 As not shown, other hardware and / or software modules may be used in conjunction with the page rendering device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0143] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the steps of the page rendering method provided in any of the foregoing embodiments of the present invention. The method includes: when a network request for a target page is detected initiated by the native application terminal calling the web page terminal, the network request is intercepted and the intercepted network request is temporarily stored; based on the received rendering instructions for the target page, the temporarily stored network request is executed to obtain the page data corresponding to the network request; the page data and the pre-rendered data of the target page are sent to the web page terminal so that the web page terminal can process the page data and the pre-rendered data to obtain the rendering result of the target page.
[0144] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the page rendering method provided in any embodiment of the present invention.
[0145] This embodiment provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the steps of the page rendering method provided in any of the foregoing embodiments of the present invention. The method includes: intercepting the network request and temporarily storing the intercepted network request when a network request for a target page is detected initiated by a native application calling a web page; 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 pre-rendered data of the target page to the web page so that the web page can process the page data and pre-rendered data to obtain the rendering result of the target page.
[0146] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0147] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0148] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0149] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or page rendering device. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0150] This embodiment provides a computer program product on which a computer program is stored. When the program is executed by a processor, it implements the steps of the page rendering method provided in any of the foregoing embodiments of the present invention.
[0151] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0152] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A page rendering method, characterized in that, When applied to native applications, the method includes: If a network request for a target page is detected initiated by the native application client calling the web client, the network request is intercepted and temporarily stored. Based on the received rendering instructions for the target page, execute the temporarily stored network request to obtain the page data corresponding to the network request; The page data and the pre-rendered data of the target page are sent to the web page so that the web page can process the page data and the pre-rendered data to obtain the rendering result of the target page.
2. The page rendering method according to claim 1, characterized in that, The temporary storage of the intercepted network requests includes: Determine whether the target page is in a pre-rendered state; When the target page is in the pre-rendered state, the intercepted network requests are temporarily stored.
3. The page rendering method according to claim 2, characterized in that, Determining whether the target page is in a pre-rendering state includes: Determine whether each preloaded data in local storage includes the pre-rendered data; If the preloaded data includes the pre-rendered data, it is determined that the target page is in the pre-rendered state; If the preloaded data does not include the pre-rendered data, it is determined that the target page is not in the pre-rendered state.
4. The page rendering method according to claim 2, characterized in that, Before intercepting the network request initiated by the native application client calling the web client for the target page, the method further includes: Upon receiving an embedding configuration request for the webpage, the interception rules are reconfigured; wherein the reconfigured interception rules include: intercepting the network request when the native application calls the webpage, and temporarily storing the intercepted network request when it is determined that the target page is in the pre-rendering state.
5. The page rendering method according to claim 2, characterized in that, After determining whether the target page is in a pre-rendered state, the method further includes: if the target page is not in the pre-rendered state, executing the network request through a native request class; The step of executing 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: executing the temporarily stored network request through the native request class based on the received rendering instruction to obtain the page data corresponding to the network request.
6. The page rendering method according to claim 1, characterized in that, The step of sending the page data and the pre-rendered data of the target page to the web page client, so that the web page client can process the page data and the pre-rendered data to obtain the rendering result of the target page, includes: The page data, the pre-rendered data, and the navigation bar configuration data of the target page are sent to the web page so that the web page can process the page data, the pre-rendered data, and the configuration data to obtain the rendering result.
7. The page rendering method according to claim 6, characterized in that, Before sending the page data, the pre-rendered data, and the navigation bar configuration data of the target page to the web page, so that the web page can process the page data, the pre-rendered data, and the configuration data to obtain the rendering result, the method further includes: Upon receiving a loading request for the navigation bar from the webpage, the loading request is intercepted and temporarily stored. Based on the received rendering instructions, the temporarily stored loading request is executed to obtain the configuration data corresponding to the loading request.
8. The page rendering method according to claim 7, characterized in that, Before intercepting and temporarily storing the loading request sent by the webpage for the navigation bar, the method further includes: Upon receiving an application launch command, a communication channel is created between the native application and the web page, and the calling rules for the communication channel are initialized and configured. The calling rules include intercepting the loading request when the web page calls the communication channel to send the loading request to the native application and temporarily storing the intercepted loading request.
9. The page rendering method according to claim 1, characterized in that, The step of executing the temporarily stored network request based on the received rendering instructions for the target page to obtain the page data corresponding to the network request includes: Upon receiving the rendering instruction, determine whether the network request corresponding to the target page is temporarily stored in the local memory; If the network request corresponding to the target page is temporarily stored in local memory, the temporarily stored network request is executed to obtain the page data corresponding to the network request.
10. The page rendering method according to any one of claims 1-9, characterized in that, The step of executing the temporarily stored network request based on the received rendering instructions for the target page to obtain the page data corresponding to the network request includes: Upon receiving the rendering instruction, obtain the resource address carried by the rendering instruction; Obtain the temporarily stored network request and update the request parameters of the network request based on the resource address; Execute the updated network request to obtain the page data.
11. A page rendering apparatus, characterized in that, Configured in a native application, the device includes: The interception module is used to intercept the network request and temporarily store the intercepted network request when the native application calls the web page to initiate a network request for the target page. An execution module is used to execute the temporarily stored network request based on the received rendering instructions for the target page, so as to obtain the page data corresponding to the network request; The rendering module is used to send the page data and the pre-rendered data of the target page to the web page terminal, so that the web page terminal can process the page data and the pre-rendered data to obtain the rendering result of the target page.
12. A page rendering device, characterized in that, The page rendering device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the page rendering method as described in any one of claims 1-10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the page rendering method as described in any one of claims 1-10.
