Page loading method, apparatus, device, and storage medium
Patent Information
- Application Number
- CN202310659910.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2043-06-05
AI Technical Summary
[0003]例如,金融或医疗的前端支付页面的渲染时,前端支付页面需要先加载静态资源,然后依据所加载的静态资源中的动态资源请求地址等信息加载动态资源,当网络状态较差的情况下,容易长时间白屏或加载失败,无法及时地获取网页资源,导致用户在进行电子支付的体验较差
[0018]This application provides a page loading method, apparatus, device, and storage medium. The method involves obtaining a page loading request and then acquiring hash value information of the resource mappings required to load the page based on the request. If the hash value information indicates that the page to be loaded belongs to a first type of page, a new page rendering thread is created, and page loading resources are obtained based on the new thread and the hash value information. If the hash value information indicates that the page to be loaded belongs to a second type of page, page loading resources are obtained based on the hash value information. Finally, page loading is performed based on the page loading resources. Creating a new page rendering thread and obtaining page loading resources through this thread when the page to be loaded belongs to the first type of page significantly improves page loading efficiency. Obtaining page loading resources based on hash value information when the page to be loaded belongs to the second type of page significantly improves both the efficiency and accuracy of page loading. This solution can resolve issues such as slow loading and/or failure to load pages in the financial sector, including customer consultation pages, product sales pages, online shopping pages, internal data management pages, and transaction pages. It can also resolve issues such as slow loading and/or failure to load pages in the digital healthcare sector, including registration pages, drug management pages, drug retrieval pages, and medical device management pages, greatly improving page loading efficiency and accuracy.
Smart Images

Figure CN116684242B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a page loading method, apparatus, device, and storage medium. Background Technology
[0002] In computer vision, page loading technology involves creating a front-end page to load specified Hyper Text Markup Language (HTML) content. HTML can load various static resources such as JavaScript, Cascading Style Sheets (CSS), and images, depending on the target requirements. It can also load dynamic resources using asynchronous JavaScript and Extensible Markup Language (XML), and then use these loaded static and dynamic resources to render the front-end page.
[0003] For example, when rendering a front-end payment page in finance or healthcare, the page needs to load static resources first, and then load dynamic resources based on information such as the dynamic resource request address within the loaded static resources. When network conditions are poor, this can easily lead to prolonged blank screens or loading failures, preventing timely acquisition of web page resources and resulting in a poor user experience for electronic payments. Therefore, improving the efficiency and accuracy of page loading is a pressing issue that needs to be addressed. Summary of the Invention
[0004] The main objective of this application is to provide a page loading method, apparatus, device, and storage medium, which aims to improve the efficiency and accuracy of page loading.
[0005] Firstly, this application provides a page loading method, which includes the following steps:
[0006] Obtain the page loading request, and based on the page loading request, obtain the hash value information of the resource mapping required to load the page to be loaded;
[0007] When it is determined that the page to be loaded belongs to the first type of page based on the hash value information, a new page rendering thread is created, and page loading resources are obtained based on the new page rendering thread and the hash value information;
[0008] When it is determined that the page to be loaded belongs to the second type of page based on the hash value information, the page loading resources are obtained based on the hash value information.
[0009] The page is loaded based on the page loading resources.
[0010] Secondly, this application also provides a page loading device, which includes a first acquisition module, a creation module, and a page loading module, wherein:
[0011] The first acquisition module is used to acquire a page loading request and acquire the hash value information of the resource mapping required to load the page to be loaded based on the page loading request;
[0012] The creation module is used to create a new page rendering thread when it is determined from the hash value information that the page to be loaded belongs to the first type of page.
[0013] The first acquisition module is further configured to acquire page loading resources based on the page rendering new thread and hash value information;
[0014] The first acquisition module is further configured to acquire page loading resources based on the hash value information when it is determined that the page to be loaded belongs to the second type of page based on the hash value information;
[0015] The page loading module is used to load a page based on the page loading resource.
[0016] Thirdly, this application also provides a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the page loading method described above.
[0017] Fourthly, this application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the page loading method described above.
[0018] This application provides a page loading method, apparatus, device, and storage medium. The method involves obtaining a page loading request and then acquiring hash value information of the resource mappings required to load the page based on the request. If the hash value information indicates that the page to be loaded belongs to a first type of page, a new page rendering thread is created, and page loading resources are obtained based on the new thread and the hash value information. If the hash value information indicates that the page to be loaded belongs to a second type of page, page loading resources are obtained based on the hash value information. Finally, page loading is performed based on the page loading resources. Creating a new page rendering thread and obtaining page loading resources through this thread when the page to be loaded belongs to the first type of page significantly improves page loading efficiency. Obtaining page loading resources based on hash value information when the page to be loaded belongs to the second type of page significantly improves both the efficiency and accuracy of page loading. This solution can resolve issues such as slow loading and / or failure to load pages in the financial sector, including customer consultation pages, product sales pages, online shopping pages, internal data management pages, and transaction pages. It can also resolve issues such as slow loading and / or failure to load pages in the digital healthcare sector, including registration pages, drug management pages, drug retrieval pages, and medical device management pages, greatly improving page loading efficiency and accuracy. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a page loading method provided in an embodiment of this application;
[0021] Figure 2 A flowchart illustrating another page loading method provided in an embodiment of this application;
[0022] Figure 3 for Figure 1 A flowchart illustrating the sub-steps of the page loading method in the document;
[0023] Figure 4 A schematic block diagram of a page loading device provided in an embodiment of this application;
[0024] Figure 5 for Figure 4 A schematic block diagram of a submodule of the page loading device in the diagram;
[0025] Figure 6 for Figure 4A schematic block diagram of another submodule of the page loading device in the diagram;
[0026] Figure 7 for Figure 4 A schematic block diagram of a submodule of the page loading device in the diagram;
[0027] Figure 8 A schematic block diagram of another page loading device provided in the embodiments of this application;
[0028] Figure 9 This is a schematic block diagram of the structure of a computer device provided in an embodiment of this application.
[0029] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0030] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0031] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0032] Currently, when rendering front-end payment pages in finance or healthcare, the front-end payment page needs to load static resources first, and then load dynamic resources based on information such as the dynamic resource request address in the loaded static resources. When the network conditions are poor, it is easy to have a long white screen or fail to load, and it is impossible to obtain web page resources in time, resulting in a poor user experience when making electronic payments.
[0033] To address the aforementioned problems, this application provides a page loading method, apparatus, device, and storage medium. The page loading method obtains a page loading request and, based on the request, acquires hash value information of the resource mappings required to load the page to be loaded. When the hash value information determines that the page to be loaded belongs to a first type of page, a new page rendering thread is created, and page loading resources are acquired based on the new thread and the hash value information. When the hash value information determines that the page to be loaded belongs to a second type of page, page loading resources are acquired based on the hash value information. Then, page loading is performed based on the page loading resources. Creating a new page rendering thread and acquiring page loading resources through this thread when the page to be loaded belongs to the first type of page significantly improves page loading efficiency. Acquiring page loading resources based on hash value information when the page to be loaded belongs to the second type of page significantly improves both the efficiency and accuracy of page loading.
[0034] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0035] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0036] This application provides a page loading method, apparatus, device, and storage medium. The page loading method can be applied to computer devices, such as mobile phones, tablets, laptops, desktop computers, personal digital assistants, and wearable devices. For example, when the computer device is a laptop, the laptop obtains a page loading request and, based on the request, obtains the hash value information of the resource mapping required to load the page to be loaded. If the hash value information determines that the page to be loaded belongs to a first type of page, a new page rendering thread is created, and page loading resources are obtained based on the new thread and the hash value information. If the hash value information determines that the page to be loaded belongs to a second type of page, page loading resources are obtained again based on the hash value information. Page loading is performed based on these resources, greatly improving the efficiency and accuracy of page loading on the laptop.
[0037] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0038] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a page loading method provided in an embodiment of this application.
[0039] like Figure 1 As shown, the page loading method includes steps S101 to S104.
[0040] Step S101: Obtain a page loading request, and obtain the hash value information of the resource mapping required to load the page to be loaded based on the page loading request.
[0041] It should be noted that this page refers to a computer vision page. This page may include customer consultation pages, product sales pages, online shopping pages, internal data management pages, or transaction pages in the financial field, as well as registration pages, drug management pages, drug retrieval pages, and medical device management pages in the digital healthcare field. Of course, it may also include various front-end pages in other fields. This application embodiment does not specifically limit this.
[0042] Page loading requests include, but are not limited to, entry page access requests or page redirection requests. These requests include the Uniform Resource Locator (URL) address of the page to be accessed. The URL address includes the protocol portion, domain portion, and anchor portion, for example, https: / / www.abc.com#web-prefetch=B.
[0043] Protocol part: "https: / / " is the protocol part of the URL, indicating that the webpage uses Hyper Text Transfer Protocol over Secure Socket Layer (HTTPS). In addition, various other protocols can be used on the Internet, such as Hyper Text Transfer Protocol (HTTP) and File Transfer Protocol (FTP). " / / " is the separator.
[0044] Domain name part: "www.abc.com" is the domain name part of this URL.
[0045] Anchor part: "#web-prefetch=B" is the anchor part of this URL. This anchor part can be used as a carrier of hash value information. This anchor part is not a required part of the URL.
[0046] In one embodiment, such as Figure 2 As shown, steps S201 to S202 are included before obtaining the page loading request.
[0047] Step S201: Obtain the front-end source code of historically generated pages, wherein the historically generated pages are pages that have been loaded before the current timestamp.
[0048] Among them, the historical generated pages are the pages that have been loaded before the current timestamp. For example, if the current time is October 5, 2022, the front-end source code before October 5, 2022 can be retrieved.
[0049] Step S202: Call webpack to configure the front-end source code of each of the previously generated historical pages, and generate the resource files and hash value information corresponding to each of the previously generated historical pages.
[0050] In one embodiment, webpack is invoked to configure the front-end source code of each historically generated page, generating multiple sub-resource files corresponding to each historically generated page. A preset hash algorithm is then used to calculate the hash value information corresponding to each historically generated page. By invoking webpack to configure the front-end source code of each historically generated page, the multiple sub-resource files corresponding to each historically generated page can be accurately obtained, and by calculating the hash value information corresponding to each historically generated page based on the preset hash algorithm, the hash value information corresponding to each historically generated page can be accurately obtained.
[0051] In one embodiment, webpack is invoked to configure the front-end source code of previously generated pages, generating static resource files for webpage display. These static resource files include JS files, CSS files, and assets files. The static resource files of each previously generated page are stored to improve the efficiency and accuracy of retrieving static resource files for subsequent page displays. A preset hash algorithm is used to perform hash operations on each sub-file within the static resource files, generating a hash value for each sub-file. This preset hash algorithm can be selected based on actual conditions, and this embodiment does not impose a specific limitation. For example, the hash algorithm can be SHA-1, SHA-224, SHA-256, or SHA-384. By configuring the front-end source code of previously generated pages using webpack, the static resource files corresponding to those pages can be accurately obtained.
[0052] It should be noted that the location where the static resource files of each historically generated page are stored can be selected according to the actual situation. This embodiment of the invention does not impose a specific limitation on this. For example, the static resource files of each generated page can be stored on a server.
[0053] In one embodiment, after generating the static resource files for previously generated pages, a NodeJS script is started to iterate through and read each static resource file. The Node.js `fs` module reads the file path, and the `createHash` method of the `crypto` module obtains the hash value of a specified file. This yields the hash value information for all resource files in the current version, and the hash value information corresponding to the static resource files of each previously generated page is stored. The NodeJS script can accurately read each static resource file and its corresponding hash value information.
[0054] In one embodiment, a page loading request is obtained, which includes the URL address of the page to be accessed. The hash value information of the resource mappings required to load the page is obtained from the anchor portion of the URL address. By accurately obtaining the hash value information of the resource mappings required to load the page from the anchor portion of the URL address, the efficiency and accuracy of page loading are greatly improved.
[0055] Step S102: When it is determined that the page to be loaded belongs to the first type of page based on the hash value information, a new page rendering thread is created, and page loading resources are obtained based on the new page rendering thread and the hash value information.
[0056] The first type of page is a webpage that belongs to the homepage on the front end.
[0057] In one embodiment, when the page to be loaded is determined to belong to the first type of page based on the hash value information, a new thread for page rendering is created through a Service Worker. This new thread then retrieves the page loading resources corresponding to the hash value information. Creating a new thread for page rendering when the page to be loaded belongs to the first type of page solves the problem of the front-end page JS engine rendering execution relying solely on a single thread. It does not consume the resources of the existing page rendering thread, greatly improving the efficiency and accuracy of page loading.
[0058] Specifically, the Service Worker creates a new thread for page rendering, runs the new thread, and retrieves the page loading resources for the homepage corresponding to the hash value information from the local machine. This achieves the goal of retrieving the page loading resources for the homepage without consuming network resources, greatly improving the efficiency and accuracy of page loading.
[0059] For example, upon receiving a page loading request for a product sales page in the financial sector, the system obtains the hash value information of the resource mapping required to load the page based on the page loading request. When the product sales page to be loaded is determined to be a first-type page based on the hash value information, a new page rendering thread is created. The system then obtains the product sales page loading resources based on the new page rendering thread and the hash value information. The product sales page is then loaded and generated based on the product sales page loading resources. This achieves the goal of obtaining the page loading resources for the product sales page without consuming network resources, greatly improving the efficiency and accuracy of page loading.
[0060] For example, upon receiving a page loading request for a registration page in the digital healthcare field, the system obtains the hash value information of the resource mapping required to load the page based on the page loading request. When the system determines that the registration page to be loaded is a first-type page based on the hash value information, a new page rendering thread is created. The system then obtains the registration page loading resources based on the new page rendering thread and the hash value information. The system loads the page and generates the registration page based on the registration page loading resources. This achieves the goal of obtaining the page loading resources for the registration page without consuming network resources, greatly improving the efficiency and accuracy of page loading.
[0061] Step S103: When it is determined that the page to be loaded belongs to the second type of page based on the hash value information, the page loading resources are obtained based on the hash value information.
[0062] The second type of page is a webpage that is a front-end page but not the homepage.
[0063] In one embodiment, such as Figure 3 As shown, step S103 includes sub-steps S1031 to S1035.
[0064] Sub-step S1031: Determine whether the resource file of the page to be loaded has been updated based on the hash value information.
[0065] In one embodiment, historical hash value information of the page to be loaded is obtained. This historical hash value information refers to the hash values displayed before the current timestamp when the page was displayed. When multiple hash values match the corresponding historical hash values in the historical hash value information, it is determined that the resource files of the page to be loaded have not been updated. When at least one hash value is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource files of the page to be loaded have been updated. By comparing each hash value in the hash value information with each hash value in the historical hash value information, it is possible to accurately determine whether the resource files of the page to be loaded have been updated.
[0066] In one embodiment, the historical hash value information of the page to be loaded can be obtained by: obtaining the historical anchor information of the page to be loaded based on the URL address in the page loading request, and then retrieving the historical hash value information from the historical anchor information. This method of accurately obtaining historical hash value information based on the URL address greatly improves the efficiency and accuracy of page loading.
[0067] Sub-step S1032: If it is determined from the hash value information that the resource file of the page to be loaded does not exist and has not been updated, the page loading resource is obtained from the local machine based on the hash value information.
[0068] When multiple hash values in the hash value are the same as the corresponding historical hash values in the historical hash value information, it is determined that the resource file of the page to be loaded has not been updated. The resource file corresponding to the hash value information is obtained from the local cached resource file library, and the page loading resource can be obtained.
[0069] Sub-step S1033: If it is determined from the hash value information that the resource file of the page to be loaded has been updated, determine the updated sub-resource file from the hash value information.
[0070] When at least one hash value is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource file of the page to be loaded has been updated, and the updated sub-resource file is determined based on multiple hash values in the hash value information.
[0071] In one embodiment, the method for determining the existence of updated sub-resource files based on multiple hash values in the hash value information can be as follows: comparing multiple hash values in the hash value information with each historical hash value in the historical hash value information, and determining the sub-resource files corresponding to different hash values as the sub-resource files that have been updated.
[0072] For example, the hash value information includes hash value 1, hash value 2, hash value 3, hash value 4, and hash value 5, and the historical hash value information includes historical hash value 1, historical hash value 2, historical hash value 3, historical hash value 4, and historical hash value 5. Hash value 1, hash value 2, hash value 3, hash value 4, and hash value 5 are matched one-to-one with historical hash value 1, historical hash value 2, historical hash value 3, historical hash value 4, and historical hash value 5. If hash value 2 and historical hash value 2 are different, it is determined that the sub-resource corresponding to hash value 2 has been updated.
[0073] Sub-step S1034: Send a download request for the updated sub-resource file to the server based on the hash value information, and receive the updated sub-resource file returned by the server based on the download request; and obtain the unupdated sub-resource file from the local machine based on the hash value information.
[0074] Based on the hash value information, a download request for the updated sub-resource file is sent to the server. The server retrieves the corresponding updated sub-resource file based on the download request and sends the updated sub-resource file to the computer device. The computer device receives the updated sub-resource file from the server to obtain the updated sub-resource file. Additionally, the non-updated sub-resource file is retrieved from the local machine based on the hash value information. By requesting the download of updated sub-resource files from the server, the efficiency of resource file retrieval is greatly improved. Furthermore, retrieving non-updated sub-resource files from the local machine reduces network resource consumption, significantly enhancing the efficiency of resource file downloads.
[0075] Sub-step S1035: If it is determined from the hash value information that the resource file of the page to be loaded has been updated, a download request for the resource file is sent to the server based on the hash value information, and all resource files returned by the server based on the download request are received.
[0076] If the hash value indicates that the resource files for the page to be loaded have been updated, a download request for the resource files is sent to the server based on the hash value. The server then retrieves all the resource files required to load the page based on the hash value and sends them to the computer device. The computer device receives all the resource files returned by the server based on the download request. Requesting all resource files from the server using hash value information eliminates the need to determine which sub-resource files are updated, thus preventing errors in file retrieval during page loading.
[0077] Step S104: Load the page according to the page loading resources.
[0078] After obtaining all page loading resources, running the page loading resources to load the pages can accurately generate the target page corresponding to the page loading request, greatly improving page loading efficiency and accuracy.
[0079] For example, upon receiving a page loading request for a payment page in the financial sector, where the payment page varies depending on the product selected by each user, the system obtains hash value information of the resource mapping required to load the payment page based on the page loading request. If the hash value information determines that the payment page to be loaded is a second type of page, the system determines whether the resource file of the payment page to be loaded has been updated. If the hash value information determines that the resource file of the payment page to be loaded has not been updated, the system obtains the page loading resources locally based on the hash value information. If the hash value information determines that the resource file of the payment page to be loaded has been updated, the system determines the updated sub-resource file based on the hash value information. The system sends a download request for the updated sub-resource file to the server based on the hash value information and receives the updated sub-resource file returned by the server based on the download request. The system also obtains the non-updated sub-resource file locally based on the hash value information. If the hash value information determines that the resource file of the payment page to be loaded has been updated, the system sends a download request for the resource file to the server based on the hash value information and receives the resource file returned by the server based on the download request. The system then generates the payment page based on the returned resources. By requesting all resource files from the server using hash value information, the step of determining which sub-resource files to update can be eliminated, preventing errors in file retrieval during page loading and greatly improving page loading efficiency and accuracy.
[0080] For example, upon receiving a page loading request for a drug dispensing page in the digital healthcare field, where the medication prescribed to each patient differs, the system obtains hash value information of the resource mapping required to load the drug dispensing page based on the page loading request. If the hash value information determines that the drug dispensing page to be loaded is a second-type page, the system determines whether the resource file of the drug dispensing page to be loaded has been updated. If the hash value information determines that the resource file of the drug dispensing page to be loaded has not been updated, the system obtains page loading resources locally based on the hash value information. If the hash value information determines that the resource file of the drug dispensing page to be loaded has been updated, the system determines the updated sub-resource file based on the hash value information. The system sends a download request for the updated sub-resource file to the server based on the hash value information and receives the updated sub-resource file returned by the server based on the download request. The system also obtains the non-updated sub-resource file locally based on the hash value information. If the hash value information determines that the resource file of the drug dispensing page to be loaded has been updated, the system sends a download request for the resource file to the server based on the hash value information and receives the resource file returned by the server based on the download request. The system then generates the drug dispensing page based on the returned resources. By requesting all resource files from the server using hash value information, the step of determining which sub-resource files to update can be eliminated, preventing errors in file retrieval during page loading and greatly improving page loading efficiency and accuracy.
[0081] The page loading method provided in the above embodiments obtains a page loading request and acquires the hash value information of the resource mapping required to load the page based on the page loading request. When it is determined that the page to be loaded belongs to a first type of page based on the hash value information, a new page rendering thread is created, and page loading resources are acquired based on the new page rendering thread and the hash value information. When it is determined that the page to be loaded belongs to a second type of page based on the hash value information, page loading resources are acquired based on the hash value information. Then, the page is loaded based on the page loading resources. When the page to be loaded belongs to a first type of page, creating a new page rendering thread and acquiring page loading resources through the new thread greatly improves page loading efficiency. When the page to be loaded belongs to a second type of page, acquiring page loading resources based on the hash value information greatly improves both page loading efficiency and accuracy. This solution can solve the problems of slow page loading and / or page loading failure in the financial field, such as customer consultation pages, product sales pages, online shopping pages, internal data management pages, or transaction pages, as well as the problems of slow page loading and / or page loading failure in the digital healthcare field, such as registration pages, drug management pages, drug retrieval pages, and medical device management pages, greatly improving page loading efficiency and accuracy.
[0082] Please refer to 4. Figure 4 This is a schematic block diagram of a page loading device provided in an embodiment of this application.
[0083] like Figure 4 As shown, the page loading device 300 includes a first acquisition module 310, a creation module 320, and a page loading module 330, wherein:
[0084] The first acquisition module 310 is used to acquire a page loading request and acquire the hash value information of the resource mapping required to load the page to be loaded based on the page loading request;
[0085] The creation module 320 is used to create a new page rendering thread when it is determined from the hash value information that the page to be loaded belongs to the first type of page.
[0086] The first acquisition module 310 is further configured to acquire page loading resources based on the page rendering new thread and hash value information;
[0087] The first acquisition module 310 is further configured to acquire page loading resources based on the hash value information when it is determined that the page to be loaded belongs to the second type of page based on the hash value information;
[0088] The page loading module 330 is used to load a page according to the page loading resource.
[0089] In one embodiment, such as Figure 5 As shown, the first acquisition module 310 includes a first determination module 311 and a first acquisition submodule 312, wherein:
[0090] The first determining module 311 is used to determine whether the resource file of the page to be loaded has been updated based on the hash value information;
[0091] The first acquisition submodule 312 is used to acquire page loading resources from the local machine based on the hash value information when it is determined from the hash value information that the resource file of the page to be loaded does not have an update.
[0092] In one embodiment, such as Figure 6 As shown, the first acquisition module 310 includes a second determination module 313 and a first acquisition submodule 314, wherein:
[0093] The second determining module 313 is used to determine, based on the hash value information, that there is an updated sub-resource file when it is determined based on the hash value information that the resource file of the page to be loaded has been updated;
[0094] The first acquisition submodule 314 is configured to send a download request for an updated sub-resource file to the server based on the hash value information, and receive the updated sub-resource file returned by the server based on the download request; and to acquire an unupdated sub-resource file from the local machine based on the hash value information.
[0095] In one embodiment, such as Figure 7 As shown, the first acquisition module 310 includes a sending module 315 and a receiving module 316, wherein:
[0096] The sending module 315 is used to send a resource file download request to the server based on the hash value information when it is determined from the hash value information that the resource file of the page to be loaded has been updated.
[0097] The receiving module 316 is used to receive all resource files returned by the server based on the download request.
[0098] In one embodiment, the first determining module 311 is further configured to:
[0099] Obtain the historical hash value information of the page to be loaded, wherein the historical hash value information is the hash value information of the page to be loaded before the current timestamp;
[0100] When multiple hash values are identical to the corresponding historical hash values in the historical hash value information, it is determined that the resource file of the page to be loaded has not been updated.
[0101] When at least one of the hash values is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource file of the page to be loaded has been updated.
[0102] In one embodiment, such as Figure 8 As shown, the page loading device 400 further includes a second acquisition module 410 and a generation module 420, wherein:
[0103] The second acquisition module 410 is used to acquire the front-end source code of historically generated pages, wherein the historically generated pages are pages that have been loaded before the current timestamp;
[0104] The generation module 420 is used to call webpack to configure the front-end source code of each of the historically generated pages, and generate resource files and hash value information corresponding to each of the historically generated pages.
[0105] In one embodiment, the generation module 420 is further configured to:
[0106] Webpack is invoked to configure the front-end source code of each of the previously generated historical pages, generating multiple sub-resource files corresponding to each of the previously generated historical pages;
[0107] The hash values of each of the sub-resource files are calculated according to a preset hash algorithm to generate hash value information corresponding to each of the historically generated pages.
[0108] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the above-mentioned page loading device can be referred to the corresponding process in the aforementioned page loading method embodiments, and will not be repeated here.
[0109] Please see Figure 9 , Figure 9 This is a schematic block diagram of the structure of a computer device provided in an embodiment of this application.
[0110] like Figure 9 As shown, the computer device 500 includes a processor 502 and a memory 503 connected via a system bus 501, wherein the memory 503 may include a storage medium and internal memory.
[0111] The storage medium may store a computer program. The computer program includes program instructions that, when executed, cause the processor to perform any page loading method.
[0112] The processor 502 provides computing and control capabilities to support the operation of the entire computer device.
[0113] Internal memory provides an environment for the execution of computer programs stored in storage media. When these computer programs are executed by the processor, the processor can perform any page loading method.
[0114] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0115] It should be understood that processor 502 can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, the general-purpose processor can be a microprocessor or any conventional processor.
[0116] In one embodiment, the processor 502 is configured to run a computer program stored in a memory to perform the following steps:
[0117] Obtain the page loading request, and based on the page loading request, obtain the hash value information of the resource mapping required to load the page to be loaded;
[0118] When it is determined that the page to be loaded belongs to the first type of page based on the hash value information, a new page rendering thread is created, and page loading resources are obtained based on the new page rendering thread and the hash value information;
[0119] When it is determined that the page to be loaded belongs to the second type of page based on the hash value information, the page loading resources are obtained based on the hash value information.
[0120] The page is loaded based on the page loading resources.
[0121] In one embodiment, when the processor 502 obtains page loading resources based on the hash value information after determining that the page to be loaded belongs to the second type of page based on the hash value information, it is configured to:
[0122] The hash value information is used to determine whether the resource file of the page to be loaded has been updated;
[0123] If it is determined from the hash value information that the resource file of the page to be loaded has not been updated, the page loading resource is obtained from the local machine based on the hash value information.
[0124] In one embodiment, after determining whether the resource file of the page to be loaded has been updated based on the hash value information, the processor 502 is further configured to:
[0125] If it is determined from the hash value information that the resource file of the page to be loaded has been updated, then the updated sub-resource file is determined from the hash value information.
[0126] Based on the hash value information, a download request for the updated sub-resource file is sent to the server, and the updated sub-resource file is received from the server based on the download request; and,
[0127] Retrieve the unupdated sub-resource files from the local machine based on the hash value information.
[0128] In one embodiment, after determining whether the resource file of the page to be loaded has been updated based on the hash value information, the processor 502 is further configured to:
[0129] If it is determined from the hash value information that the resource file of the page to be loaded has been updated, a download request for the resource file is sent to the server based on the hash value information.
[0130] Receive all resource files returned by the server based on the download request.
[0131] In one embodiment, the processor 502, when implementing the hash value information including multiple hash values, and when determining whether the resource file of the page to be loaded has been updated based on the hash value information, is configured to:
[0132] Obtain the historical hash value information of the page to be loaded, wherein the historical hash value information is the hash value information of the page to be loaded before the current timestamp;
[0133] When multiple hash values are identical to the corresponding historical hash values in the historical hash value information, it is determined that the resource file of the page to be loaded has not been updated.
[0134] When at least one of the hash values is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource file of the page to be loaded has been updated.
[0135] In one embodiment, before implementing the page loading request, the processor 502 is further configured to implement:
[0136] Obtain the front-end source code of historically generated pages, which are pages loaded before the current timestamp;
[0137] Webpack is invoked to configure the front-end source code of each of the previously generated historical pages, generating resource files and hash value information corresponding to each previously generated historical page.
[0138] In one embodiment, when the processor 502 implements the call to webpack to configure the front-end source code of each of the historically generated pages and generate resource files and hash value information corresponding to each of the historically generated pages, it is used to:
[0139] Webpack is invoked to configure the front-end source code of each of the previously generated historical pages, generating multiple sub-resource files corresponding to each of the previously generated historical pages;
[0140] The hash values of each of the sub-resource files are calculated according to a preset hash algorithm to generate hash value information corresponding to each of the historically generated pages.
[0141] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the computer device described above can be referred to the corresponding process in the aforementioned page loading method embodiments, and will not be repeated here.
[0142] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and the method implemented when the program instructions are executed can be referred to various embodiments of the page loading method of this application.
[0143] The computer-readable storage medium can be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium can be non-volatile or volatile. Alternatively, the computer-readable storage medium can be an external storage device of the computer device, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0144] Furthermore, the computer-readable storage medium may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system, at least one application required for a function, etc.; and the data storage area may store data created based on the use of blockchain nodes, etc.
[0145] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0146] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification, unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “the” are intended to include the plural forms.
[0147] It should also be understood that the term "and / or" as used in this specification refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, herein, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0148] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above descriptions are merely specific implementations of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A page loading method, characterized in that, include: Obtain a page loading request, and obtain the hash value information of the resource mapping required to load the page to be loaded based on the page loading request. The page loading request includes the Uniform Resource Locator address of the page to be accessed. When it is determined that the page to be loaded belongs to the first type of page based on the hash value information, a new thread for creating page rendering is established through ServiceWorker, and the new thread for creating page rendering is run and the page loading resources of the homepage corresponding to the hash value information are obtained from the local machine. The first type of page is the homepage webpage. When it is determined that the page to be loaded belongs to the second type of page based on the hash value information, the page loading resources are obtained based on the hash value information. Load the page according to the page loading resources; Wherein, when determining that the page to be loaded belongs to the second type of page based on the hash value information, obtaining the page loading resources based on the hash value information includes: Obtain the historical hash value information of the page to be loaded, where the historical hash value information is the hash value information of the page to be loaded displayed before the current timestamp; when multiple hash values are the same as the corresponding historical hash values in the historical hash value information, it is determined that the resource file of the page to be loaded has not been updated; when at least one hash value is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource file of the page to be loaded has been updated; if it is determined that the resource file of the page to be loaded has not been updated based on the hash value information, obtain the page loading resources from the local machine based on the hash value information.
2. The page loading method as described in claim 1, characterized in that, The resource file includes multiple sub-resource files; after determining whether the resource file of the page to be loaded has been updated based on the hash value information, the process further includes: If it is determined from the hash value information that the resource file of the page to be loaded has been updated, then the updated sub-resource file is determined from the hash value information. Based on the hash value information, a download request for the updated sub-resource file is sent to the server, and the updated sub-resource file is received from the server based on the download request; and, Retrieve the unupdated sub-resource files from the local machine based on the hash value information.
3. The page loading method as described in claim 1, characterized in that, After determining whether the resource file of the page to be loaded has been updated based on the hash value information, the method further includes: If it is determined from the hash value information that the resource file of the page to be loaded has been updated, a download request for the resource file is sent to the server based on the hash value information. Receive all resource files returned by the server based on the download request.
4. The page loading method as described in claim 1, characterized in that, Before obtaining the page loading request, the process also includes: Obtain the front-end source code of historically generated pages, which are pages loaded before the current timestamp; Webpack is invoked to configure the front-end source code of each of the previously generated historical pages, generating resource files and hash value information corresponding to each previously generated historical page.
5. The page loading method as described in claim 4, characterized in that, The process of calling webpack to configure the front-end source code of each of the previously generated pages, and generating resource files and hash value information corresponding to each of the previously generated pages, includes: Webpack is invoked to configure the front-end source code of each of the previously generated historical pages, generating multiple sub-resource files corresponding to each of the previously generated historical pages; The hash values of each of the sub-resource files are calculated according to a preset hash algorithm to generate hash value information corresponding to each of the historically generated pages.
6. A page loading device, characterized in that, The page loading device includes a first acquisition module, a creation module, and a page loading module, wherein: The first acquisition module is used to acquire a page loading request and acquire the hash value information of the resource mapping required to load the page to be loaded based on the page loading request; The creation module is used to establish a new thread for creating page rendering through Service Worker when it is determined that the page to be loaded belongs to the first type of page based on the hash value information. The new thread for creating page rendering is run and the page loading resources of the homepage corresponding to the hash value information are obtained from the local machine. The first type of page is the homepage webpage. The first acquisition module is further configured to acquire page loading resources based on the page rendering new thread and hash value information; The first acquisition module is further configured to acquire historical hash value information of the page to be loaded, wherein the historical hash value information is the hash value information when the page to be loaded was displayed before the current timestamp; when multiple hash values are the same as the corresponding historical hash values in the historical hash value information, it is determined that the resource file of the page to be loaded has not been updated; when at least one hash value is different from the corresponding historical hash value in the historical hash value information, it is determined that the resource file of the page to be loaded has been updated; if it is determined that the resource file of the page to be loaded has not been updated according to the hash value information, the page loading resources are acquired from the local machine according to the hash value information. The page loading module is used to load a page based on the page loading resource.
7. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the page loading method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the page loading method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Page loading method and device, electronic equipment and storage medium
CN116204749A