Page loading method, device, computer equipment and storage medium
By combining synchronous and asynchronous loading technologies in page loading, the problem of low efficiency of traditional page loading methods is solved, and the necessary information is quickly displayed and non-essential information is loaded on demand, improving the user experience.
Patent Information
- Application Number
- CN201811250183.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-10-25
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2038-10-25
AI Technical Summary
Traditional page loading methods load all pages during the initialization phase, resulting in slow loading speed and inefficiency, especially when there are dependencies between pages, many pages that do not need to be loaded will slow down the loading process.
The combination of asynchronous loading and synchronous loading is adopted. The synchronization information that must be loaded is first displayed through the synchronous loading method, and then the non-essential asynchronous information is loaded through the asynchronous loading method to realize on-demand loading.
Improve page loading speed and efficiency, optimize the loading process, improve user experience, avoid blockage through asynchronous loading, and ensure timely display of synchronous information.
Smart Images

Figure CN109582890B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page loading method, device, computer equipment and storage medium. Background Art
[0002] With the continuous development of Internet technology, more and more page systems with diverse functions and complex architectures are appearing on the market. The traditional page loading method is to start loading the page during the page initialization phase and then display it in the display interface. For example, when an insurance company's salesperson issues a bill and opens the billing system, a lot of data is loaded during page initialization, and the display speed is very slow. It takes a long time to wait, which consumes the user's waiting time. Then, the pages in the system are often not independent, and there are corresponding dependencies between the pages. The above page loading method requires that all pages be loaded during the page initialization phase, but most of the pages are not needed, resulting in slow page loading and low page loading efficiency. Summary of the invention
[0003] The embodiments of the present invention provide a page loading method, device, computer equipment and storage medium to solve the problem of low page loading efficiency.
[0004] A page loading method, comprising:
[0005] Obtaining an access request sent by a client, wherein the access request includes a loading instruction;
[0006] Obtaining a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information;
[0007] Execute the loading instruction to obtain an initialization page corresponding to the loading instruction;
[0008] Load the synchronization loading information in the initialization page by using a synchronization loading method, and display the synchronization loading information on the initialization page to obtain a synchronization page;
[0009] When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page.
[0010] A page loading device, comprising:
[0011] An access request acquisition module, used to acquire an access request sent by a client, wherein the access request includes a loading instruction;
[0012] A loading information list acquisition module, used to acquire a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information;
[0013] An initialization page acquisition module, used to execute the loading instruction and obtain the initialization page corresponding to the loading instruction;
[0014] A synchronous page loading module, used to load the synchronous loading information in the initialization page by using a synchronous loading method, and display the synchronous loading information on the initialization page to obtain a synchronous page;
[0015] The target page loading module is used to load the asynchronous loading information in the initialization page using an asynchronous loading method when the synchronous page loading is completed, and display the asynchronous loading information on the synchronous page to obtain the target page.
[0016] A computer device comprises 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 above-mentioned page loading method when executing the computer program.
[0017] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned page loading method are implemented.
[0018] In the above-mentioned page loading method, device, computer equipment and storage medium, firstly, an access request sent by the client is obtained. Then, a list of loading information corresponding to the loading instruction is obtained. Next, the loading instruction is executed to obtain an initialization page, and the synchronous loading information is loaded on the initialization page using a synchronous loading method, and the synchronous loading information is displayed on the initialization page to obtain a synchronous page, so that the page corresponding to the synchronous information can be displayed preferentially. Finally, the asynchronous loading information is loaded using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain a target page. Since the synchronous page fully displays the synchronous loading information, and the asynchronous loading information is displayed on the target page on demand, on-demand loading is realized, which speeds up the page response speed. As a result, the target page fully displays the page loading information, thereby improving the page loading efficiency, optimizing the page loading process, presenting a better page effect, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 It is a schematic diagram of the application environment of the page loading method provided by an embodiment of the present invention;
[0021] Figure 2 is an example diagram of a page loading method provided by an embodiment of the present invention;
[0022] Figure 3 is another example diagram of the page loading method provided by an embodiment of the present invention;
[0023] Figure 4 is another example diagram of the page loading method provided by an embodiment of the present invention;
[0024] Figure 5 is another example diagram of the page loading method provided by an embodiment of the present invention;
[0025] Figure 6 is another example diagram of the page loading method provided by an embodiment of the present invention;
[0026] Figure 7 is a principle block diagram of a page loading device provided by an embodiment of the present invention;
[0027] Figure 8 is another principle block diagram of the page loading device provided by an embodiment of the present invention;
[0028] Fig. 9 is another principle block diagram of the page loading device provided by an embodiment of the present invention;
[0029] Fig.10 It is a schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] The page loading method provided in this application can be applied to Figure 1In an application environment, the client communicates with the server through the network, the server receives the access request sent by the client, and then obtains the loading information list corresponding to the loading instruction, executes the loading instruction, and obtains the initialization page. And the synchronous loading information is loaded in a synchronous loading manner on the initialization page, and the synchronous loading information is displayed on the initialization page to obtain a synchronous page. Then, the asynchronous loading information is loaded in an asynchronous loading manner, so that the asynchronous loading information is displayed on the synchronous page to obtain a target page. Among them, the client can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers.
[0032] In one embodiment, Figure 2 As shown, this method is applied to Figure 1 The server in the example is used as an example to illustrate the following steps:
[0033] S10: Obtain an access request sent by the client, where the access request includes a loading instruction.
[0034] The access request is a request sent by the client to the server to access the page information. Specifically, the client can trigger the access request through a predetermined action, such as by clicking a predetermined button or entering a predetermined instruction. When the client detects or recognizes the instruction corresponding to the above action, it triggers the generation of the access request and sends the access request to the server, which obtains the access request. The access request includes a loading instruction, which refers to an instruction sent by the client to the server to load the access page.
[0035] In a specific implementation, the business personnel of an insurance company need to perform an issuance operation on the insurance system, and first need to access the policy page of the insurance system. Therefore, the business personnel will send an access request to access the policy page by clicking a control (such as a button) on the interface of the policy system. The loading instruction contained in the access request is triggered and generated on the client based on the condition of the issuance operation.
[0036] S20: Obtain a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information.
[0037] Among them, the loading information list refers to a list composed of loading information corresponding to each loading instruction, and the loading information is the page information that needs to be loaded generated by the server according to the loading instruction of the client. It can be understood that the loading information corresponding to each loading instruction has at least one page information. For example, the loading instruction is the initialization order page information, and the loading information corresponding to the loading instruction for initializing the order page includes customer information loading page information, channel information loading page information, target information loading page information, and payment loading page information.
[0038] Among them, synchronous loading information refers to information on the page on the client that meets the preset importance, and asynchronous loading information refers to information on the page on the client that does not meet the preset importance. Among them, the preset importance is a pre-set critical value for judging the importance of page information. The preset importance can be selected according to the needs of the actual application and is not limited here. For example, a client page is an insurance policy issuance page. It can be understood that the information such as the policy number, insurance type and institution involved in the insurance policy issuance page is closely related to the insurance policy issuance page and meets the preset importance. Therefore, the information such as the policy number, insurance type and institution involved in the insurance policy issuance page is synchronous loading information. At the same time, the issuance page of the insurance policy system may also load some announcements of the issuing agency, or the edge of the page may pop up advertising page information and other information that does not meet the preset importance, which is asynchronous loading information.
[0039] It should be noted that, in this embodiment, each loading instruction corresponds to a loading information list, and a loading information list corresponds to multiple loading information. Each loading information is synchronous loading information or asynchronous loading information, which can be determined according to a preset importance. The loading information list can be configured by caching the loading information.
[0040] S30: Execute the loading instruction to obtain an initialization page corresponding to the loading instruction.
[0041] The initialization page refers to a complete page that matches the loading instruction. Specifically, the initialization page is obtained through the initialization function init() in js jquery, where the init() function is a function that executes the initialization method after the current web page is loaded, and the initialization page corresponding to the loading instruction is obtained. By obtaining the initialization page corresponding to the instruction, the loading information in the initialization page can be loaded later, thereby realizing efficient loading of information.
[0042] S40: Loading the synchronous loading information in the initialization page by using the synchronous loading method, and displaying the synchronous loading information on the initialization page to obtain the synchronous page.
[0043] Among them, the synchronous loading method means that the loading of page information is in synchronous mode, also known as blocking mode. Specifically, in the process of parsing the loading information list by the browser on the server side, when the code for loading the js file corresponding to the synchronous loading information is parsed, the parsing of the file referenced on the page corresponding to the synchronous loading information is suspended, and the code for loading the js file is executed, waiting for the file to be downloaded. When the execution of the code in the waiting file is completed, the file parsing is continued. It can be understood that the synchronous loading method will prevent the server from subsequent processing of the synchronous loading information, that is, it stops the subsequent file parsing. Therefore, the synchronous loading method stops the subsequent file loading (such as images), rendering or code execution. Thereby, the page corresponding to the synchronous loading information can be displayed preferentially.
[0044] Among them, the synchronization page refers to the page corresponding to the synchronization information, which is used to fully display the necessary information. Continuing with the example of "the loading instruction is the initialization order page" in step S20, since the initialization order page is the "synchronization page" in this step, the loading information corresponding to the loading instruction of the initialization order page includes customer information loading page information, channel information loading page information, target information loading page information and payment page information, etc. The loading page information will be fully displayed on the synchronization page. This optimizes the page reading speed, reduces the number of page requests, and improves the loading efficiency of page information.
[0045] S50: When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page using the asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page.
[0046] Among them, the asynchronous loading method refers to the loading of page information in asynchronous mode, also known as non-blocking mode. Specifically, in the process of parsing the loading information list by the browser on the server side, when the code for loading the js file corresponding to the asynchronous loading information is parsed, the file corresponding to the asynchronous loading information is parsed, the code for loading the js file is executed, and then the file is parsed without waiting for the file to be downloaded. Since the asynchronous loading method is to continue to execute the code of the subsequent js file corresponding to the asynchronous loading information while opening an additional thread to execute the script corresponding to the asynchronous loading information, the browser will continue to load the subsequent pages while downloading and executing the code of the js file to avoid blocking the interface rendering, thereby shortening the overall loading time of the asynchronous loading information. The asynchronous loading method can be asynchronous loading based on Script Element, that is, asynchronous loading is realized through DOM structure parsing after dynamically adding the script tag, or asynchronous loading based on AJAX to load the JS file, or asynchronous loading compatible with encapsulation.
[0047] Among them, the target page refers to the page corresponding to the asynchronous loading information that is fully displayed on the "synchronous page" in step S40. Specifically, when the synchronous page is loaded, the page corresponding to the asynchronous loading information is displayed on the synchronous page in the initialization page, so that the pages corresponding to the synchronous loading information and the asynchronous loading information are fully displayed on the target page. It can be understood that the synchronous page fully displays the synchronous loading information, and the asynchronous loading information can avoid blocking the page rendering, and is displayed on the target page according to the requirements of the loading instructions, realizing on-demand loading, and speeding up the page response speed. Therefore, the target page fully displays the page loading information, thereby improving the page loading efficiency, optimizing the page loading process, presenting a better page effect, and improving the user experience.
[0048] In a specific implementation, for the policy issuance page of the insurance policy system, when the loading instruction is to click the drop-down box of the employee ID type, the loading page information corresponding to the loading instruction includes multiple ID types, for example, the ID type can be an ID card. Among them, the employee ID type page is an asynchronous loading information, and the drop-down box option corresponding to the "ID card" adopts an asynchronous loading method. The asynchronous information is displayed on the target page, so that the page information is efficiently loaded.
[0049] In this embodiment, first, the access request sent by the client is obtained. Then, the loading information list corresponding to the loading instruction is obtained. Next, the loading instruction is executed to obtain the initialization page, and the synchronous loading information is loaded using the synchronous loading method on the initialization page, and the synchronous loading information is displayed on the initialization page to obtain the synchronous page, so that the page corresponding to the synchronous information can be displayed preferentially. Finally, the asynchronous loading information is loaded using the asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page. Since the synchronous page fully displays the synchronous loading information, and the asynchronous loading information is displayed on the target page on demand, on-demand loading is realized, which speeds up the page response speed. As a result, the target page fully displays the page loading information, thereby improving the page loading efficiency, optimizing the page loading process, presenting a better page effect, and improving the user experience.
[0050] In one embodiment, in step S20, obtaining a loading information list corresponding to the loading instruction specifically includes the following steps:
[0051] S21: Load the initialization page corresponding to the loading instruction to obtain the original js script.
[0052] Among them, the original js script is a JavaScript language script obtained after loading the initialization page, which is used as a standard for configuring the loading method of the loading information of the initialization page. For example, on an order page, when you click the drop-down box "Region", the initialization page of the "Region" will be loaded, such as the original js scripts such as "Beijing", "Tianjin", "Hubei" and "Guangdong". It can be understood that since the initialization page of "Region" contains multiple original js scripts, if the synchronous loading method is adopted, the loading time will inevitably be extended. Therefore, it is determined that the loading method of the initialization page is asynchronous loading.
[0053] S22: Use the loading cache to configure the original js script and obtain a loading information list corresponding to the loading instruction.
[0054] The loading cache is located between the application and the permanent data storage source, and is used to reduce the frequency of the application directly reading and writing the permanent data storage source, thereby improving the operation performance. Specifically, when requesting new data from the server, the client directly uses the cached content to operate the page, thereby reducing the time to obtain data from the server, reducing the user's waiting time, and enhancing the user experience.
[0055] Specifically, the loading page is configured by using the loading cache method, and the specific configuration is as follows: the loading method of the original js script is configured, such as synchronous loading method or asynchronous loading method. That is, the information of the js script that needs to be loaded synchronously and asynchronously is configured through the cache of loading information. When accessing the page, the elements of the initialized page need to be fully loaded, and the synchronous loading method is determined. When operating the control, it is necessary to ensure that the elements of the control are loaded sequentially, and the asynchronous loading method is determined. By configuring the original js script, the loading information list can be used more efficiently, the page loading method is clearer, and subsequent maintenance is also convenient.
[0056] In this embodiment, the initialization page is loaded to obtain the original js script. The original js script is configured using the loading cache to obtain the loading information list corresponding to the loading instruction. By configuring the original js script, the loading information list is used more efficiently, the page loading method is clearer, and subsequent maintenance is also convenient.
[0057] In one embodiment, if Figure 4 As shown, in step S40, the synchronous loading information is loaded in the initialization page using the synchronous loading method, and the synchronous loading information is displayed on the initialization page to obtain the synchronous page, which specifically includes the following steps:
[0058] S41: Obtain the name of the js script corresponding to the synchronous loading information.
[0059] The name of the js script refers to a name used to identify the js script. It can be understood that each js script corresponds to a name. Specifically, the name of the js script corresponding to the synchronous loading information can be obtained through the file name acquisition tool filename().
[0060] S42: Obtain the path of synchronous loading information according to the name of the js script.
[0061] Among them, the path refers to the address where the loading information list is stored. In this embodiment, the path of the synchronous loading information refers to the location where the synchronous loading information is stored. Specifically, after determining the name of the js script corresponding to the synchronous loading information, the name of the js script is used as a keyword, and the path of the synchronous loading information is obtained by querying, so that the synchronous loading information can be further processed quickly and accurately according to the path.
[0062] S43: If the path for acquiring the synchronous loading information is successful, the rendering operation of the current page is terminated, and the synchronous loading information in the loading path is loaded, and the synchronous loading information is displayed on the initialization page to obtain the synchronous page.
[0063] Among them, the rendering operation refers to the operation of downloading the elements at the predetermined position of the current page. Specifically, when the path of the synchronous loading information is obtained, the synchronous loading information can be loaded, therefore, the rendering operation of the current page is stopped, and the synchronous loading information is loaded, that is, the synchronous loading method is implemented. It can be understood that since it is in a blocking mode, the server will stop the rendering operation of the current page, that is, stop downloading the elements at the predetermined position of the page, so that the synchronous loading information is fully displayed on the page, that is, the synchronous page. This speeds up the loading speed of the synchronous loading information, so that the synchronous loading information is displayed preferentially on the synchronous page.
[0064] In this embodiment, the name of the js script corresponding to the synchronous loading information is first obtained. Then, the path of the synchronous loading information is obtained according to the name of the js script, so that the synchronous loading information can be further processed quickly and accurately according to the path. Finally, if the path of the synchronous loading information is successfully obtained, the rendering operation of the current page is terminated, and the synchronous loading information in the path is loaded, and the synchronous loading information is displayed on the page to obtain a synchronous page, thereby speeding up the loading speed of the synchronous loading information, so that the synchronous loading information is preferentially displayed on the synchronous page.
[0065] In one embodiment, if Figure 5 As shown, in step S50, when the synchronous page loading is completed, the asynchronous loading information is loaded in the initialization page using the asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page, which specifically includes the following steps:
[0066] S51: Get a preset script element.
[0067] The preset script element refers to a pre-set client script element. It is used to add an async attribute or a defer attribute so that the js script corresponding to the asynchronous loading information does not have to be executed synchronously. Specifically, this embodiment obtains the preset script element, which is conducive to the subsequent efficient execution of the js script corresponding to the asynchronous loading information through the preset script element.
[0068] S52: inserting a preset script element into the document object model structure corresponding to the asynchronous loading information to obtain the asynchronous js script of the asynchronous loading information.
[0069] The asynchronous js script refers to a js script obtained by inserting a preset script element into the document object model structure corresponding to the asynchronous loading information.
[0070] Among them, the document object model (abbreviated DOM) structure refers to the tree structure of the document of the page loading information. Specifically, the preset script element is inserted into the DOM structure corresponding to the asynchronous loading information to obtain the asynchronous js script, thereby realizing non-blocking download of js code, and then the asynchronous js script is used to load the page elements of the asynchronous loading information, blocking the initialization processing of some pages.
[0071] S53: Execute the asynchronous js script, display the asynchronous loading information on the synchronous page, and obtain the target page.
[0072] Specifically, the asynchronous js script is executed, that is, the page elements of the asynchronous loading information are loaded asynchronously for the asynchronous js script, and the initialization processing of the blocked part of the page is performed, so that the page elements of the asynchronous loading information are loaded asynchronously for the asynchronous js script, so that the asynchronous loading information is displayed on the synchronous page, and the target page is obtained. The target page fully displays the page loading information, thereby improving the page loading efficiency.
[0073] In this embodiment, first obtain a preset script element. Then insert the preset script element into the text object model structure corresponding to the asynchronous loading information to obtain the asynchronous js script of the asynchronous loading information, so that the asynchronous js script will not block the loading of page elements and block the initialization processing of some pages. Finally, execute the asynchronous js script, display the asynchronous loading information on the synchronous page, obtain the target page, and perform the initialization processing of the blocked part of the page, so that the asynchronous loading information is displayed on the synchronous page, and obtain the target page. The target page fully displays the page loading information, which improves the page loading efficiency.
[0074] In one embodiment, if Figure 6 As shown, in step S50, when the synchronous page loading is completed, the asynchronous loading information is loaded in the initialization page using the asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page, which specifically includes the following steps:
[0075] S51: Use AJAX to obtain the js script corresponding to the asynchronous loading information.
[0076] Among them, AJAX is a technology that can update part of the web page information without reloading the entire web page. In this embodiment, AJAX is used to obtain the js script corresponding to the asynchronous loading information. It can be understood that since AJAX does not need to reload the initialization page, it directly obtains the js script corresponding to the asynchronous loading information, which improves the acquisition speed of the js script corresponding to the asynchronous loading information.
[0077] S52: Run the js script corresponding to the asynchronous loading information through the script execution tool, display the asynchronous loading information on the synchronous page, and obtain the target page.
[0078] Specifically, the script execution tool can be an eval tool, that is, a tool for executing string generation statements. Specifically, running the js script corresponding to the asynchronous loading information through the script execution tool speeds up the execution speed of the js script and improves the efficiency of the asynchronous loading method.
[0079] Specifically, the js script corresponding to the asynchronous loading information is run through the script execution tool, so that the asynchronous loading information is displayed on the synchronous page to obtain the target page. The target page fully displays the page information, thereby improving the page loading efficiency.
[0080] In this embodiment, by using AJAX to obtain the js script corresponding to the asynchronous loading information, the acquisition speed of the js script corresponding to the asynchronous loading information is improved. The js script corresponding to the asynchronous loading information is run by the script execution tool, and the asynchronous loading information is displayed on the synchronous page to obtain the target page. The target page fully displays the page information, which improves the page loading efficiency.
[0081] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0082] In one embodiment, a page loading device is provided, which corresponds one-to-one to the page loading method in the above embodiment. Figure 7As shown, the page loading device includes an access request acquisition module 10, a loading information list acquisition module 20, an initialization page acquisition module 30, a synchronization page loading module 40 and a target page loading module 50. The functional modules are described in detail as follows:
[0083] An access request acquisition module 10, used to acquire an access request sent by a client, the access request including a loading instruction;
[0084] A loading information list acquisition module 20 is used to acquire a loading information list corresponding to a loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information;
[0085] An initialization page acquisition module 30, used to execute the loading instruction and obtain the initialization page corresponding to the loading instruction;
[0086] A synchronous page loading module 40 is used to load synchronous loading information in an initialization page by using a synchronous loading method, and display the synchronous loading information on the initialization page to obtain a synchronous page;
[0087] The target page loading module 50 is used to load asynchronous loading information in the initialization page by using asynchronous loading when the synchronous page loading is completed, and display the asynchronous loading information on the synchronous page to obtain the target page.
[0088] Preferably, if Figure 8 As shown, the loading information list acquisition module 20 includes an original js script acquisition unit 21 and a loading information list acquisition unit 22.
[0089] The original js script obtaining unit 21 is used to load the initialization page and obtain the original js script;
[0090] The loading information list obtaining unit 22 is used to configure the original js script using the loading cache to obtain the loading information list corresponding to the loading instruction.
[0091] Preferably, if Fig. 9 As shown, the synchronous page loading module 40 includes a script name obtaining unit 41 , a path obtaining unit 42 and a synchronous page loading unit 43 .
[0092] The script name obtaining unit 41 is used to obtain the name of the js script corresponding to the synchronous loading information;
[0093] A path acquisition unit 42 is used to acquire the path of the synchronous loading information according to the name of the js script;
[0094] The synchronous page loading unit 43 is used to terminate the rendering operation of the current page if the path for acquiring the synchronous loading information is successful, and load the synchronous loading information in the path, and display the synchronous loading information on the page to obtain the synchronous page.
[0095] Preferably, the target page loading module includes a script element acquisition unit, an asynchronous js script acquisition unit and a first target page loading unit.
[0096] The script element acquisition unit is used to acquire the preset script element;
[0097] An asynchronous js script acquisition unit is used to insert a preset script element into the document object model structure corresponding to the asynchronous loading information to obtain the asynchronous js script of the asynchronous loading information;
[0098] The first target page loading unit is used to execute the asynchronous js script, display the asynchronous loading information on the synchronous page, and obtain the target page.
[0099] Preferably, the target page loading module also includes a js script acquiring unit and a second target page loading unit.
[0100] The js script acquisition unit is used to use AJAX to obtain the js script corresponding to the asynchronous loading information;
[0101] The second target page loading unit is used to run the js script corresponding to the asynchronous loading information through a script execution tool, display the asynchronous loading information on a synchronous page, and obtain a target page.
[0102] For the specific definition of the page loading device, please refer to the definition of the page loading method above, which will not be repeated here. Each module in the above-mentioned page loading device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0103] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used by the page loading method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a page loading method is implemented.
[0104] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0105] Obtaining an access request sent by a client, wherein the access request includes a loading instruction;
[0106] Obtaining a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information;
[0107] Execute the loading instruction to obtain an initialization page corresponding to the loading instruction;
[0108] Load the synchronization loading information in the initialization page by using a synchronization loading method, and display the synchronization loading information on the initialization page to obtain a synchronization page;
[0109] When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page.
[0110] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0111] An access request acquisition module, used to acquire an access request sent by a client, wherein the access request includes a loading instruction;
[0112] A loading information list acquisition module, used to acquire a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information;
[0113] An initialization page acquisition module, used to execute the loading instruction and obtain the initialization page corresponding to the loading instruction;
[0114] A synchronous page loading module, used to load the synchronous loading information in the initialization page by using a synchronous loading method, and display the synchronous loading information on the initialization page to obtain a synchronous page;
[0115] The target page loading module is used to load the asynchronous loading information in the initialization page using an asynchronous loading method when the synchronous page loading is completed, and display the asynchronous loading information on the synchronous page to obtain the target page.
[0116] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0117] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0118] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A page loading method, It is characterized in that The page loading method comprises: Obtaining an access request sent by a client, wherein the access request includes a loading instruction; Obtaining a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information; the synchronous loading information is information in the page of the client that meets a preset importance; the asynchronous loading information is information in the page of the client that does not meet the preset importance; Execute the loading instruction to obtain an initialization page corresponding to the loading instruction; Load the synchronization loading information in the initialization page by using a synchronization loading method, and display the synchronization loading information on the initialization page to obtain a synchronization page; When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page.
2. The page loading method according to claim 1, It is characterized in that The obtaining the loading information list corresponding to the loading instruction includes: Load the initialization page corresponding to the loading instruction to obtain the original js script; The original js script is configured using the loading cache to obtain a loading information list corresponding to the loading instruction.
3. The page loading method according to claim 1, It is characterized in that The method of loading the synchronous loading information in the initialization page by synchronous loading, and displaying the synchronous loading information on the initialization page to obtain the synchronous page includes: Get the name of the js script corresponding to the synchronous loading information; Obtain the path of the synchronous loading information according to the name of the js script; If the path of the synchronous loading information is successfully obtained, the rendering operation of the current page is terminated, and the synchronous loading information in the path is loaded, and the synchronous loading information is displayed on the initialization page to obtain the synchronous page.
4. The page loading method according to claim 3, It is characterized in that When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page by using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page, including: Get the preset script element; Insert the preset script element into the document object model structure corresponding to the asynchronous loading information to obtain the asynchronous js script of the asynchronous loading information; Execute the asynchronous js script, display the asynchronous loading information on the synchronous page, and obtain the target page.
5. The page loading method according to claim 1, It is characterized in that When the synchronous page is loaded, the asynchronous loading information is loaded in the initialization page by using an asynchronous loading method, and the asynchronous loading information is displayed on the synchronous page to obtain the target page, including: Use AJAX to obtain the js script corresponding to the asynchronous loading information; The js script corresponding to the asynchronous loading information is run through a script execution tool, the asynchronous loading information is displayed on the synchronous page, and the target page is obtained.
6. A page loading device, It is characterized in that The page loading device comprises: An access request acquisition module, used to acquire an access request sent by a client, wherein the access request includes a loading instruction; A loading information list acquisition module is used to acquire a loading information list corresponding to the loading instruction, wherein the loading information list includes synchronous loading information and asynchronous loading information; the synchronous loading information is information in the page of the client that meets a preset importance; the asynchronous loading information is information in the page of the client that does not meet the preset importance; An initialization page acquisition module, used to execute the loading instruction and obtain the initialization page corresponding to the loading instruction; A synchronous page loading module, used to load the synchronous loading information in the initialization page by using a synchronous loading method, and display the synchronous loading information on the initialization page to obtain a synchronous page; The target page loading module is used to load the asynchronous loading information in the initialization page using an asynchronous loading method when the synchronous page loading is completed, and display the asynchronous loading information on the synchronous page to obtain the target page.
7. The page loading device according to claim 6, It is characterized in that The loading information list acquisition module includes: An original js script acquisition unit, used to load the initialization page corresponding to the loading instruction to obtain the original js script; The loading information list acquisition unit is used to configure the original js script using the loading cache to obtain the loading information list corresponding to the loading instruction.
8. The page loading device according to claim 6, It is characterized in that The synchronous page loading module includes: A script name obtaining unit, used to obtain the name of the js script corresponding to the synchronous loading information; A path acquisition unit, used for acquiring the path of the synchronous loading information according to the name of the js script; The synchronous page loading unit is used to terminate the rendering operation of the current page if the path of the synchronous loading information is successfully obtained, and load the synchronous loading information in the path, and display the synchronous loading information on the initialization page to obtain the synchronous page.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the page loading method according to any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the page loading method according to any one of claims 1 to 5 are implemented.
