Web page first screen rendering method and device

By judging and storing the request body during the first screen rendering of the web page and rendering in parallel, the problem of long waiting time for the first screen rendering of the web page is solved, and the rendering speed and user experience are improved.

CN113934953BActive Publication Date: 2024-11-08SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111180747.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2024-11-08
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

In the prior art, the user wait time for rendering the home screen of a web page is long and cannot be effectively reduced.

Method used

When receiving a user-triggered web page access request, it is determined whether there is a request body for obtaining dynamic resources in the code execution environment. If it exists, it obtains response data and renders it in parallel. If it does not exist, it sends a network request to obtain page data. And store the request body for subsequent rendering.

Benefits of technology

By storing the request body and parallel rendering components in advance, the response data acquisition time is reduced, the rendering speed of the web page home screen is improved, and the waiting time is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934953B_ABST
    Figure CN113934953B_ABST
Patent Text Reader

Abstract

The present application discloses a method for rendering the first screen of a web page. The method includes: upon receiving a web page first screen access request triggered by a user, judging whether there is a request body for obtaining dynamic resources of the first screen of the web page in the environment where the code is executed according to the uniform resource locator of the first screen of the web page; upon determining that the request body exists in the environment, obtaining response data in response to the request body from the server according to the request body; receiving the response data returned by the server, and storing the response data in the environment; initializing multiple components included in the first screen of the web page, obtaining the response data from the environment, and using the response data to render each component in parallel. The present application can improve the rendering speed of the first screen of a web page in an application and reduce user waiting time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for rendering the first screen of a web page. Background Art

[0002] With the development of Internet technology and the popularization of mobile terminals, people are more and more accustomed to obtaining various types of information from the Internet through clients (including web clients and local clients). However, as the functions included in the client continue to be enriched, the content displayed by the web pages (web pages) in the client is becoming richer and richer. Usually, a web page will present multiple screens of display content. The user can trigger the mobile terminal to perform a screen flipping operation of the web page through sliding or clicking operations, thereby switching the home page of the web page to other screen pages. In the prior art, when a user accesses the home page, the mobile terminal will send a network request to the server to obtain the home page data. After that, the mobile terminal renders the home page through the obtained home page data, thereby realizing the display of the home page. Generally speaking, it takes a certain amount of time from the user triggering a request to open a home page to the application displaying the home page, resulting in the user having to experience a long waiting time. In order to reduce the waiting time of users, the prior art downloads the static resources (html, css, js, image and other resources) of the home page to the local computer. When the user visits the home page, the application localizes the access request of the remote resources, thereby eliminating the time required for network communication and achieving the purpose of speeding up the home page. The inventor found that with this optimization method, users still need a relatively long waiting time. Summary of the invention

[0003] In view of this, a method, apparatus, computer device and computer-readable storage medium for rendering the first screen of a web page are now provided to solve the problem of how to further reduce the waiting time required for users when rendering the first screen of a web page.

[0004] This application provides a method for rendering the first screen of a web page, including:

[0005] When receiving a webpage home screen access request triggered by a user, judging whether there is a request body for obtaining a dynamic resource of the webpage home screen in the code execution environment according to the uniform resource locator of the webpage home screen;

[0006] When it is determined that the request body exists in the environment, obtaining response data corresponding to the request body from the server according to the request body;

[0007] Receive response data returned by the server, and store the response data in the environment;

[0008] Initialize multiple components included in the first screen of the webpage, obtain the response data from the environment, and use the response data to render each component in parallel.

[0009] Optionally, upon receiving a webpage home screen access request triggered by a user, determining whether there is a request body for obtaining a dynamic resource for the webpage home screen in a code execution environment according to a uniform resource locator of the webpage home screen includes:

[0010] When receiving a webpage home screen access request triggered by a user, generating a network request according to the access request, wherein the network request includes a uniform resource locator of the webpage home screen;

[0011] The network request is intercepted, and it is determined whether there is a request body for obtaining the dynamic resource of the first screen of the web page in the environment according to the uniform resource locator in the network request.

[0012] Optionally, the method further comprises:

[0013] When there is no request body for obtaining the dynamic resource of the first screen of the webpage in the environment, obtaining the page data corresponding to the first screen of the webpage from the server through the network request, and storing the request body contained in the network request in the environment;

[0014] The page data is used to render the first screen of the web page.

[0015] Optionally, the initializing multiple components included in the first screen of the webpage, obtaining the response data from the environment, and using the response data to render each component in parallel includes:

[0016] Initializing multiple components included in the first screen of the webpage, and querying from the environment whether there is response data corresponding to the multiple components;

[0017] If there is response data corresponding to the multiple components in the environment, each component is rendered in parallel using the response data corresponding to the multiple components.

[0018] Optionally, the initializing multiple components included in the first screen of the webpage, obtaining the response data from the environment, and rendering each component in parallel using the response data further includes:

[0019] If there is no response data corresponding to the multiple components in the environment, obtaining the page data corresponding to the first screen of the web page from the server through a network request, and storing the request body contained in the network request in the environment;

[0020] The page data is used to render the first screen of the web page.

[0021] Optionally, the method further comprises:

[0022] After the response data is obtained from the environment, the response data is deleted from the environment.

[0023] Optionally, obtaining the response data from the environment and using the response data to render each component in parallel includes:

[0024] If the response data does not exist in the environment, and the status of the request body is pending, waiting to receive the response data returned by the server, and storing the response data in the environment;

[0025] The response data is obtained from the environment, and each component is rendered in parallel using the response data.

[0026] The present application also provides a web page first screen rendering device, including:

[0027] A judgment module, for, upon receiving a webpage home screen access request triggered by a user, judging, according to the uniform resource locator of the webpage home screen, whether there is a request body for obtaining the dynamic resource of the webpage home screen in the code execution environment;

[0028] an acquisition module, configured to acquire response data corresponding to the request body from a server according to the request body when it is determined that the request body exists in the environment;

[0029] A storage module, used for receiving the response data returned by the server and storing the response data in the environment;

[0030] The rendering module is used to initialize multiple components included in the first screen of the web page, obtain the response data from the environment, and use the response data to render each component in parallel.

[0031] The present application also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.

[0032] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.

[0033] The embodiment of the present application stores the request body for obtaining the dynamic resources of the web page home screen in the environment. In this way, when the user visits the web page home screen, the response data can be directly obtained from the server through these request bodies, and the response data can be used to render multiple components contained in the web page home screen in parallel, without waiting for the page data of the web page home screen to be parsed before obtaining the request body for obtaining the response data, thereby saving the time for obtaining the response data, improving the rendering speed of the web page home screen, and reducing the user's waiting time. In addition, by rendering components in parallel, the rendering speed of the embodiment can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a schematic diagram of the environment of the web page first screen rendering method of an embodiment of the present application;

[0035] Figure 2 A flowchart of an embodiment of the method for rendering the first screen of a web page described in this application;

[0036] Figure 3 A schematic diagram of a detailed flow chart of the steps of determining whether there is a request body for obtaining a dynamic resource of the first screen of a web page in an environment where code is executed according to the uniform resource locator of the first screen of the web page when a user-triggered request for accessing the first screen of the web page is received in one embodiment of the present application;

[0037] Figure 4 A flowchart of another embodiment of the method for rendering the first screen of a web page in an application described in the present application;

[0038] Figure 5 A schematic diagram of a detailed process of initializing multiple components included in the home screen of the web page in one embodiment of the present application, obtaining the response data from the environment, and rendering each component in parallel using the response data;

[0039] Figure 6 A schematic diagram of a detailed flow chart of the steps of obtaining the response data from the environment and rendering each component in parallel using the response data in one embodiment of the present application;

[0040] Figure 7 This is a schematic diagram of the implementation process of the web page first screen rendering method in this application;

[0041] Figure 8 A program module diagram of an embodiment of the web page first screen rendering device described in this application;

[0042] Fig. 9 A schematic diagram of the hardware structure of a computer device for executing a method for rendering the first screen of a web page provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The advantages of the present application are further described below in conjunction with the accompanying drawings and specific embodiments.

[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0045] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0046] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0047] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0048] When an application renders the first screen of a web page, it does so through the browser kernel, which is responsible for interpreting the syntax of the web page (such as HTML, JavaScript) and rendering (displaying) the web page, that is, parsing and rendering the web page through the browser kernel. Usually, the browser kernel is also called a rendering engine. The rendering engine is used to convert HTML / CSS / JavaScript text and its corresponding resource files into image results for display.

[0049] Usually, when a page is opened using a client (local client or web client) with a browser kernel installed on a mobile terminal with a limited display area (for example, a smart phone), the page performance is determined by the rendering speed of the first screen of the page. Since the page rendered by the client needs to download the first screen data, execute JavaScript scripts to parse the first screen data, and then parse out various tags and insert them into the HTML document of the page. The browser kernel then parses and typesets the HTML document, initiates a first screen image request, decodes the loaded image, and renders the page. Only then can the user see the first screen of the page. This series of operations is executed serially, so it takes a relatively long time.

[0050] Generally speaking, dynamic data needs to be downloaded over the network, so it usually takes more than 600ms. It is also time-consuming to execute JavaScript scripts to render the first screen, usually more than 300ms. As a result, users will experience a long waiting process every time they open a new page, which seriously affects the user experience.

[0051] Figure 1 The schematic diagram of the application environment of the web page first screen rendering method according to the embodiment of the present application is schematically shown. In an exemplary embodiment, the system of the application environment may include a terminal device 10 and a server 20. Among them, the terminal device 10 forms a wireless or wired connection with the server 20. The terminal device 10 can be a mobile phone, an iPAD, a tablet computer, etc. The server 20 can be a server cluster or a cloud computing center composed of one server or multiple servers, etc., which is not limited here. The above-mentioned web page first screen rendering method can be run in the terminal device 10.

[0052] It should be noted that the web page first screen rendering method in the present application is applied to the web page first screen rendering scenario with different faces for different people.

[0053] Among them, the web page home screen rendering scenario with different faces for different users means that when different users request the same web page home screen, the page data displayed on the web page home screen may be different.

[0054] See also Figure 2 , which is a flowchart of a web page first screen rendering method according to an embodiment of the present application. It can be understood that the flowchart in the embodiment of the present method is not used to limit the order of executing the steps. As can be seen from the figure, the web page first screen rendering method provided in the present embodiment includes:

[0055] Step S20: upon receiving a web page home screen access request triggered by a user, determining whether there is a request body for obtaining dynamic resources of the web page home screen in the code execution environment according to the uniform resource locator of the web page home screen.

[0056] Specifically, the web page home screen is the web page content displayed on the first screen of the local client (APP) or the web client on the screen of the terminal device.

[0057] The Uniform Resource Locator (URL) is the network address required for the client to request the server to obtain the page code of the first screen of the web page.

[0058] The environment (Global) in which the code is executed may be a window object in a browser, or a global object in a NodeServer (node ​​server), which is not limited in this embodiment.

[0059] The dynamic resource is interface data that needs to be obtained from the server through a network request, wherein the interface data is data required for rendering components in the first screen of a web page.

[0060] Usually, we abstract the entire web page home screen (HTML) into different business modules. Different business modules are called different components. Component rendering often depends on interface data. What the component renders is the DOM node. Once all DOM nodes are rendered, the display page corresponding to the web page home screen can be obtained.

[0061] Among them, the request body may include the request method (GET, POST, etc.) for requesting the first screen of the web page, the URL for requesting the first screen of the web page, the request-related Headers object for requesting the first screen of the web page, the params for requesting the first screen of the web page, etc.

[0062] It should be noted that the interface data mentioned above may refer to the interface data required by all components included in the first screen of the web page.

[0063] In this embodiment, when a user wants to access the home screen of a web page, the user can trigger a request to access the home screen of the web page by clicking a target control in the page.

[0064] In the prior art, when a user triggers a request to access the home screen of a web page, the client will request the server to obtain the page data of the home screen of the web page according to the Uniform Resource Locator (URL) of the home screen of the web page. However, in the present application, after receiving a page access request, it will not first request the server to obtain the page data of the home screen of the web page according to the Uniform Resource Locator (URL) of the home screen of the web page, but will first determine whether there is a request body for obtaining the dynamic resources of the home screen of the web page in the environment where the code is executed according to the URL of the home screen of the web page. When the request body does not exist in the environment, a network request will be sent to the server according to the URL of the home screen of the web page to obtain the page data of the home screen of the web page.

[0065] In an exemplary embodiment, see Figure 3 , when receiving a web page home screen access request triggered by a user, judging whether there is a request body for obtaining the dynamic resources of the web page home screen in the code execution environment according to the uniform resource locator of the web page home screen includes: step S31, when receiving a web page home screen access request triggered by a user, generating a network request according to the access request, and the network request includes the uniform resource locator of the web page home screen; step S32, intercepting the network request, and judging whether there is a request body for obtaining the dynamic resources of the web page home screen in the environment according to the uniform resource locator in the network request.

[0066] Specifically, when a user triggers a request to access the first screen of a web page, a network request will be generated based on the access request, so that the server can be requested to obtain the page data corresponding to the first screen of the web page through the network request. After the network request is generated, the client will intercept the network request and determine whether there is a request body that matches the first screen of the web page in the environment based on the URL in the network request. Specifically, the URL contained in the network request can be compared with the URL contained in the request body stored in the environment. If there is a URL that is the same as the URL contained in the network request, it can be determined that there is a request body that matches the first screen of the web page in the environment. If there is no URL that is the same as the URL contained in the network request, it can be determined that there is no request body that matches the first screen of the web page in the environment.

[0067] Step S21, when it is determined that the request body exists in the environment, obtaining response data in response to the request body from the server according to the request body.

[0068] Specifically, when it is determined that the request body exists in the environment, the response data of the request body can be directly obtained from the server through the request body, without waiting for the page code of the first screen of the web page to be parsed and then obtaining the response data of the request body from the server through the request body obtained after parsing, thereby saving the time of obtaining the response data.

[0069] Step S22, receiving response data returned by the server, and storing the response data in the environment.

[0070] Step S23, initializing multiple components included in the first screen of the web page, obtaining the response data from the environment, and using the response data to render each component in parallel.

[0071] Specifically, after receiving the response data returned by the server, the response data can be stored in the environment, so that when the first screen of the web page needs to be rendered later, all components contained in the first screen of the web page can be initialized first. After that, the response data can be directly obtained from the environment, and these response data can be used to render multiple components in parallel to obtain the first screen of the web page.

[0072] The embodiment of the present application stores the request body for obtaining the dynamic resources of the web page home screen in the environment. In this way, when the user visits the web page home screen, the response data can be directly obtained from the server through these request bodies, and the response data can be used to render multiple components contained in the web page home screen in parallel, without waiting for the page data of the web page home screen to be parsed before obtaining the request body for obtaining the response data, thereby saving the time for obtaining the response data, improving the rendering speed of the web page home screen, and reducing the user's waiting time. In addition, by rendering components in parallel, the rendering speed can be further improved.

[0073] In an exemplary embodiment, see Figure 4 The method also includes: step S40, when there is no request body for the dynamic resource used to obtain the first screen of the web page in the environment, obtaining the page data corresponding to the first screen of the web page from the server through the network request, and storing the request body contained in the network request in the environment; step S41, using the page data to render the first screen of the web page.

[0074] Specifically, when there is no request body matching the web page home screen in the environment, the rendering of the web page home screen can be achieved through the normal web page home screen rendering logic, that is, by sending a network request to the server to obtain page data, and after receiving the page data returned by the server, the page data is used to render the web page home screen, thereby displaying the web page home screen to the user.

[0075] In an exemplary embodiment, see Figure 5 , the initialization of multiple components included in the first screen of the web page, obtaining the response data from the environment, and using the response data to render each component in parallel includes: step S50, initializing multiple components included in the first screen of the web page, and querying from the environment whether there is response data corresponding to the multiple components; step S51, if there is response data corresponding to the multiple components in the environment, then using the response data corresponding to the multiple components to render each component in parallel.

[0076] Specifically, after completing the initialization of multiple components included in the first screen of the web page, the components can be rendered. In this embodiment, when rendering, since the response data corresponding to the multiple components may not exist in the environment, when rendering, it is necessary to first query whether there is response data corresponding to the multiple components in the environment. Only when there is response data in the environment can multiple components be rendered in parallel through the response data.

[0077] In an exemplary embodiment, if there is no response data corresponding to the multiple components in the environment, the page data corresponding to the first screen of the web page is obtained from the server through a network request, and the request body contained in the network request is stored in the environment; the page data is used to render the first screen of the web page.

[0078] Specifically, when there is no response data corresponding to multiple components in the environment, normal rendering logic can be used to render the first screen of the web page, that is, the page data corresponding to the first screen of the web page can be obtained from the server through a network request, and then the first screen of the web page is rendered using the page data.

[0079] In this embodiment, in order to extract and obtain response data when the user visits the home page of the web page again, when requesting page data from the server through a network request, the request body contained in the network request will also be stored in the environment. In this way, when the user visits the home page of the web page again, the request body saved in the environment can be used to request the server to obtain response data in advance, thereby improving the rendering speed of the home page of the web page.

[0080] In an exemplary implementation, in order to ensure the timeliness and accuracy of the data, after the response data is obtained from the environment, the response data may be deleted from the environment.

[0081] In an exemplary embodiment, see Figure 6, the step of obtaining the response data from the environment and using the response data to render each component in parallel includes: step S60, if the response data does not exist in the environment and the status of the request body is pending, waiting to receive the response data returned by the server and storing the response data in the environment; step S61, obtaining the response data from the environment, and using the response data to render each component in parallel.

[0082] In this embodiment, when rendering the first screen of the web page, if the response data does not exist in the environment temporarily, but the request body exists, and the current state of the request body is pending, then in order to improve the rendering speed of the first screen of the web page, you can wait to receive the response data returned by the server, and store the response data in the environment, and then obtain the response data from the environment, and use the response data to render each component in parallel.

[0083] It should be noted that the pending state means that the task of obtaining response data from the server through the request body has neither been fulfilled nor rejected.

[0084] This application obtains page data from the server by waiting instead of directly requesting it through the network, and uses the obtained response data to render the first screen of the web page, which can improve the rendering speed of the first screen of the web page.

[0085] In order to facilitate the understanding of the present application, the implementation process of the web page first screen rendering method in the present application will be described in detail below in combination with a specific embodiment.

[0086] See also Figure 7As shown, when a user accesses the home screen of a web page, it will be determined whether there is a request body (request) for obtaining dynamic resources for the home screen of the web page in the environment (Global) where the code is executed. If the request exists in Global, the request will be obtained from Global, and the request will be used to obtain response data (response) from the server. After obtaining the response data from the server, the response data will be stored in Global. When rendering the home screen of a web page, the components contained in the home screen of the web page will be initialized first, and then it will be determined whether there is corresponding response data in Global. If there is corresponding response data, the response data will be used to render the components, and after all DOM nodes are rendered, the rendered home screen page of the web page will be obtained. In this embodiment, when it is determined that there is no corresponding response data in Global, a network request will be sent to the server to obtain the corresponding response data, and after obtaining the response data, the response data will be used to render the component, and at the same time, the request corresponding to the response data contained in the network request will be stored in Global.

[0087] In another embodiment, when there is no request body for obtaining dynamic resources for the first screen of the web page in Global, the components contained in the first screen of the web page will be initialized first, and then a network request can be sent to the server to obtain the corresponding response data, and after obtaining the response data, the response data is used to render the component, and at the same time, the request corresponding to the response data contained in the network request will be stored in Global. After all DOM nodes are rendered, the rendered first screen of the web page is obtained.

[0088] See also Figure 8 The figure shows a program module diagram of an embodiment of a web page first screen rendering device 70 of the present application.

[0089] In this embodiment, the web page first screen rendering device 70 includes a series of computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the web page first screen rendering function of each embodiment of the present application can be implemented. In some embodiments, based on the specific operations implemented by each part of the computer program instructions, the web page first screen rendering device 70 can be divided into one or more modules. The specific modules that can be divided are as follows:

[0090] The judgment module 71 is used to determine whether there is a request body for obtaining the dynamic resource of the web page home screen in the code execution environment according to the uniform resource locator of the web page home screen when receiving the web page home screen access request triggered by the user;

[0091] An acquisition module 72 is used for acquiring response data in response to the request body from a server according to the request body when it is determined that the request body exists in the environment;

[0092] A storage module 73, used for receiving the response data returned by the server and storing the response data in the environment;

[0093] The rendering module 74 is used to initialize multiple components included in the first screen of the web page, obtain the response data from the environment, and use the response data to render each component in parallel.

[0094] In an exemplary embodiment, when the judgment module 71 receives a web page home screen access request triggered by a user, it generates a network request based on the access request, wherein the network request includes a uniform resource locator of the web page home screen; intercepts the network request, and determines whether there is a request body for obtaining dynamic resources for the web page home screen in the environment based on the uniform resource locator in the network request.

[0095] In an exemplary embodiment, the acquisition module 72 is also used to obtain the page data corresponding to the first screen of the web page from the server through the network request when there is no request body for obtaining the dynamic resources for the first screen of the web page in the environment, and store the request body contained in the network request in the environment.

[0096] The rendering module 74 is further configured to render the first screen of the web page using the page data.

[0097] In an exemplary embodiment, the rendering module 74 is also used to initialize multiple components included in the first screen of the web page, and query whether there is response data corresponding to the multiple components from the environment; if there is response data corresponding to the multiple components in the environment, each component is rendered in parallel using the response data corresponding to the multiple components.

[0098] In an exemplary embodiment, the rendering module 74 is also used to obtain page data corresponding to the first screen of the web page from the server through a network request if there is no response data corresponding to the multiple components in the environment, and store the request body contained in the network request in the environment; and use the page data to render the first screen of the web page.

[0099] In an exemplary embodiment, the web page first screen rendering device 70 in the application further includes a deletion module.

[0100] The deleting module is used to delete the response data from the environment after obtaining the response data from the environment.

[0101] In an exemplary embodiment, the rendering module 74 is also used to wait for receiving the response data returned by the server and store the response data in the environment if the response data does not exist in the environment and the status of the request body is pending; obtain the response data from the environment, and use the response data to render each component in parallel.

[0102] The application embodiment stores the request body for obtaining the dynamic resources of the web page home screen in the environment. In this way, when the user visits the web page home screen, the response data can be directly obtained from the server through these request bodies, and the response data can be used to render multiple components contained in the web page home screen in parallel, without waiting for the page data of the web page home screen to be parsed before obtaining the request body for obtaining the response data, thereby saving the time for obtaining the response data, improving the rendering speed of the web page home screen, and reducing the user's waiting time. In addition, by rendering components in parallel, the rendering speed can be further improved.

[0103] Fig. 9 The schematic diagram of the hardware architecture of a computer device 8 suitable for implementing the web page first screen rendering method according to an embodiment of the present application is shown schematically. In this embodiment, the computer device 8 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. For example, it can be a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig. 9 As shown, the computer device 8 includes at least but is not limited to: a memory 120, a processor 121, and a network interface 122 that can communicate with each other through a system bus. Among them:

[0104] The memory 120 includes at least one type of computer-readable storage medium, which may be volatile or non-volatile. Specifically, the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 120 may be an internal storage module of the computer device 8, such as a hard disk or memory of the computer device 8. In other embodiments, the memory 120 may also be an external storage device of the computer device 8, such as a plug-in hard disk equipped on the computer device 8, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. Of course, the memory 120 may also include both the internal storage module of the computer device 8 and its external storage device. In this embodiment, the memory 120 is generally used to store the operating system and various application software installed on the computer device 8, such as the program code of the web page first screen rendering method, etc. In addition, the memory 120 can also be used to temporarily store various data that have been output or will be output.

[0105] In some embodiments, the processor 121 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other web page first screen rendering chip. The processor 121 is generally used to control the overall operation of the computer device 8, such as performing control and processing related to data interaction or communication with the computer device 8. In this embodiment, the processor 121 is used to run the program code stored in the memory 120 or process data.

[0106] The network interface 122 may include a wireless network interface or a wired network interface, and the network interface 122 is generally used to establish a communication link between the computer device 8 and other computer devices. For example, the network interface 122 is used to connect the computer device 8 to an external terminal through a network, to establish a data transmission channel and a communication link between the computer device 8 and the external terminal, etc. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0107] It should be pointed out that Fig. 9 Only a computer device having components 120 - 122 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may be implemented instead.

[0108] In this embodiment, the web page first screen rendering method stored in the memory 120 can be divided into one or more program modules and executed by one or more processors (processor 121 in this embodiment) to complete the present application.

[0109] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the web page first screen rendering method in the embodiment are implemented.

[0110] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, referred to as SMC), a secure digital (Secure Digital, referred to as SD) card, a flash card, etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both an internal storage unit of a computer device and an external storage device thereof. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on a computer device, such as the program code of the web page first screen rendering method in the embodiment, etc. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.

[0111] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on at least two network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment scheme of the present application. Those of ordinary skill in the art may understand and implement it without creative labor.

[0112] Through the description of the above implementation methods, a person of ordinary skill in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A web page first screen rendering method, characterized in that: include: When receiving a web page home screen access request triggered by a user, judging whether there is a request body for obtaining the dynamic resource of the web page home screen in the code execution environment according to the uniform resource locator of the web page home screen, the request body including the request method for requesting the web page home screen, the URL for requesting the web page home screen, and the Headers object related to the request for requesting the web page home screen; When it is determined that the request body exists in the environment, obtaining response data corresponding to the request body from the server according to the request body; Receive response data returned by the server, and store the response data in the environment; Initialize multiple components included in the first screen of the webpage, obtain the response data from the environment, and use the response data to render each component in parallel.

2. The web page first screen rendering method according to claim 1, characterized in that: When receiving a webpage home screen access request triggered by a user, judging whether there is a request body for obtaining a dynamic resource for the webpage home screen in the code execution environment according to the uniform resource locator of the webpage home screen includes: When receiving a webpage home screen access request triggered by a user, generating a network request according to the access request, wherein the network request includes a uniform resource locator of the webpage home screen; The network request is intercepted, and it is determined whether there is a request body for obtaining the dynamic resource of the first screen of the web page in the environment according to the uniform resource locator in the network request.

3. The web page first screen rendering method according to claim 2, characterized in that: The method further comprises: When there is no request body for obtaining the dynamic resource of the first screen of the webpage in the environment, obtaining the page data corresponding to the first screen of the webpage from the server through the network request, and storing the request body contained in the network request in the environment; The page data is used to render the first screen of the web page.

4. The web page first screen rendering method according to claim 1, characterized in that: Initializing the multiple components included in the first screen of the webpage, obtaining the response data from the environment, and using the response data to render each component in parallel includes: Initializing multiple components included in the first screen of the webpage, and querying from the environment whether there is response data corresponding to the multiple components; If there is response data corresponding to the multiple components in the environment, each component is rendered in parallel using the response data corresponding to the multiple components.

5. The web page first screen rendering method according to claim 4, characterized in that: Initializing the multiple components included in the first screen of the webpage, obtaining the response data from the environment, and using the response data to render each component in parallel also includes: If there is no response data corresponding to the multiple components in the environment, obtaining the page data corresponding to the first screen of the web page from the server through a network request, and storing the request body contained in the network request in the environment; The page data is used to render the first screen of the web page.

6. The webpage first screen rendering method according to any one of claims 1 to 5, characterized in that: The method further comprises: After the response data is obtained from the environment, the response data is deleted from the environment.

7. The webpage first screen rendering method according to claim 6, characterized in that: The obtaining the response data from the environment and using the response data to render each component in parallel includes: If the response data does not exist in the environment, and the status of the request body is pending, waiting to receive the response data returned by the server, and storing the response data in the environment; The response data is obtained from the environment, and each component is rendered in parallel using the response data.

8. A web page first screen rendering device, characterized in that: include: A judgment module, configured to, upon receiving a webpage home screen access request triggered by a user, judge whether there is a request body for obtaining the dynamic resource of the webpage home screen in the code execution environment according to the uniform resource locator of the webpage home screen, wherein the request body includes a request method for requesting the webpage home screen, a URL for requesting the webpage home screen, and a Headers object related to the request for requesting the webpage home screen; an acquisition module, configured to acquire response data corresponding to the request body from a server according to the request body when it is determined that the request body exists in the environment; A storage module, used for receiving the response data returned by the server and storing the response data in the environment; The rendering module is used to initialize multiple components included in the first screen of the web page, obtain the response data from the environment, and use the response data to render each component in parallel.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.