WO2023024436A1 - Page loading method, assembly, system, apparatus, and computer-readable storage medium - Google Patents

Page loading method, assembly, system, apparatus, and computer-readable storage medium Download PDF

Info

Publication number
WO2023024436A1
WO2023024436A1 PCT/CN2022/074662 CN2022074662W WO2023024436A1 WO 2023024436 A1 WO2023024436 A1 WO 2023024436A1 CN 2022074662 W CN2022074662 W CN 2022074662W WO 2023024436 A1 WO2023024436 A1 WO 2023024436A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
static
module
request
page
Prior art date
Application number
PCT/CN2022/074662
Other languages
French (fr)
Chinese (zh)
Inventor
肖彦均
沈玺
汤之雄
解楠
Original Assignee
中国银联股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国银联股份有限公司 filed Critical 中国银联股份有限公司
Publication of WO2023024436A1 publication Critical patent/WO2023024436A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Definitions

  • the invention belongs to the field of web pages, and in particular relates to a page loading method, component, system, device and computer-readable storage medium.
  • the opening of the applet page is generally divided into three steps: one is to initialize the applet container, the other is to parse the page, request static resources, and the third is to load and render the page.
  • these three steps are executed sequentially by the system webview according to serial logic, and the time required to open the page is the sum of the three steps. In this way, the user sees a long loading white screen.
  • existing applet containers generally use a dynamic injection scheme to inject the code of related static resources, that is, code injection is performed in the lifecycle function of the applet page loading, which easily leads to logic errors on the page and cannot guarantee the success of the injection. Rate.
  • the present invention provides the following solutions.
  • a page loading method which is characterized in that it is applied to an application client, and the application client includes a container module, a preload module and a resource request module, and the method includes: the container module executes initialization in response to a trigger instruction; preload The module executes in response to the trigger instruction: obtain the page source code; analyze the page source code to generate the first static resource request and send it to the resource request module, and send the page source code statically injected with the preset code to the container module; the container module loads the successfully injected page source code , using interception technology to generate a second static resource request and send it to the resource request module; and, the resource request module pre-obtains the corresponding static resource in response to the first static resource request, and returns the target static resource to the container module in response to the second static resource request resource.
  • the container module is an applet container.
  • the method further includes: in response to the application start instruction, the application client sends an update request to the server to update the preset resource package.
  • the application client sends an update request to the server to update the preset resource package, and further includes: the application client sends an update request carrying the characteristic value of the local preset resource package to the server; the application client sends an update request to the server; Receive the difference package sent by the server, the difference package is generated according to the characteristic value of the local preset resource package, the latest resource package and its characteristic value; the application client combines the difference package and the local preset resource package to obtain Updated pre-built resource packs.
  • the method further includes: the container module responds to the trigger instruction of opening the target applet page, acquires and initializes the uniform resource locator of the target applet page; in parallel, the preloading module responds to opening the target applet page
  • the page trigger instruction obtains the page source code corresponding to the target applet page, and executes the first static resource request and static injection according to the page source code.
  • the method further includes: the preloading module analyzes the page source code through a preset parsing framework to obtain the static resource dependencies therein; and sends the first static resource request to the resource request module according to the static resource dependencies.
  • the method further includes: the preloading module writes the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
  • the resource requesting module pre-obtains the corresponding static resource in response to the first static resource request, and further includes: when the resource requesting module receives the first static resource request, presetting the resource according to the first static resource request The first resource matching is performed in the package; if the first resource matching is unsuccessful, the second resource matching is performed in the local network cache; if the second resource matching is unsuccessful, a network request is sent to update the local network cache.
  • returning the target static resource to the container module in response to the second static resource request includes: when the resource request module receives the second static resource request, performing The third resource is matched; if the third resource is successfully matched, the matched static resource is returned to the container module; if the third resource is not successfully matched, the fourth resource is matched in the local network cache; if the fourth resource is successfully matched, Then return the matched static resource to the container module; if the fourth resource is not matched successfully, send a network request to obtain the target static resource.
  • the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
  • a page loading component which is applied to an application client, including: a container module, configured to execute initialization in response to a trigger instruction; a preload module, configured to execute in response to the trigger instruction: obtain page source code ; Analyze the page source code to send the first static resource request to the resource request module, and send the page source code statically injected with the preset code to the container module; the container module is also used to load the successfully injected page source code, intercept the static resource request therein and Sending a second static resource request to the resource request module; and a resource request module, configured to pre-acquire corresponding static resources in response to the first static resource request, and return a target static resource to the container module in response to the second static resource request.
  • the container module is an applet container.
  • the loading component is further configured to: send an update request to the server in response to the application start instruction, so as to update the preset resource package.
  • the loading component is also used to: send an update request carrying the characteristic value of the local preset resource package to the server; , the current latest resource package and its characteristic values; combine the difference package and the local preset resource package to obtain an updated preset resource package.
  • the container module is configured to obtain and initialize the uniform resource locator of the target applet page in response to a trigger instruction for opening the target applet page; in parallel, the preload module is configured to In response to the trigger instruction for opening the target applet page, the page source code corresponding to the target applet page is obtained, and the first static resource request and static injection are performed according to the page source code.
  • the preloading module is configured to: analyze the page source code through a preset parsing framework to obtain static resource dependencies therein; and send a first static resource request to the resource request module according to the static resource dependencies.
  • the preloading module is used to: write the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
  • the resource request module is configured to: when receiving the first static resource request, perform the first resource matching in the preset resource package according to the first static resource request; if the first resource matching fails, The second resource is matched in the local network cache; if the second resource is not matched successfully, a network request is sent to update the local network cache.
  • the resource request module is configured to: when receiving the second static resource request, perform third resource matching in the preset resource package according to the second static resource request; if the third resource matching is successful, then Return the matched static resource to the container module; if the third resource is not matched successfully, perform the fourth resource match in the local network cache; if the fourth resource is successfully matched, return the matched static resource to the container module; 4. If resource matching fails, a network request is sent to obtain the target static resource.
  • the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
  • a page loading system including: an application client, which includes the page loading component as in the second aspect; an application server, which includes a resource management platform, and is used to issue updated preset resources to the application client Package and/or used to provide business static resources to application clients.
  • a page loading device comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores instructions executable by at least one processor, and the instructions are processed by at least one processor executed by a processor, so that at least one processor can execute: the method of the first aspect.
  • a computer-readable storage medium stores a program, and when the program is executed by a multi-core processor, the multi-core processor executes the method in the first aspect.
  • the timing of container initialization and static resource requests is optimized, and there is no need to wait until the container initialization is completed before starting to execute parsing pages and requesting static resources etc., to achieve the purpose of optimizing the loading timing and speeding up the page opening speed.
  • this solution adopts static injection technology, and the injection is completed through static injection before loading the page, and the timing of injection is advanced to ensure successful injection.
  • FIG. 1 is a schematic structural diagram of a page loading component according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a page loading method according to an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of a page loading method according to another embodiment of the present invention.
  • Fig. 4 is a schematic diagram of a page loading example according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a page loading system according to an embodiment of the present invention.
  • Fig. 6 is a schematic structural diagram of a page loading component according to an embodiment of the present invention.
  • A/B can mean A or B; "and/or” in this article is just an association relationship describing associated objects, indicating that there can be three relationships, For example, A and/or B may mean that A exists alone, A and B exist simultaneously, and B exists alone.
  • first”, “second”, etc. are used for descriptive purposes only, and should not be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, a feature defined as “first”, “second”, etc. may expressly or implicitly include one or more of that feature. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
  • Static resources which include js, css, img and other files generated by non-server dynamic running.
  • the page loading method provided by this application is applied to an application client, such as a WeChat client, and the application client includes a page loading component composed of a container module 11, a preload module 12 and a resource request module 13 10.
  • Fig. 2 is a schematic flow diagram of a page loading method according to an embodiment of the present application.
  • the executing subject may be one or more electronic devices; from a program point of view, the executing subject may correspondingly It is a program installed on these electronic devices.
  • the execution subject of the method may be the page loading component in the embodiment shown in FIG. 1 .
  • the method provided in this embodiment may include the following steps:
  • the container module and the preloading module receive a trigger instruction.
  • the container module may be an applet container.
  • the triggering instruction may be a triggering instruction for opening a target applet page.
  • the trigger instruction is generated after the user clicks on the target applet icon.
  • the container module and the preloading module execute their respective actions in parallel, so that the work originally performed in series can be changed into parallel execution.
  • the container module executes initialization in response to the trigger instruction.
  • the container module may, in response to a trigger instruction for opening the target applet page, acquire a uniform resource locator (URL) of the target applet page and perform initialization.
  • URL uniform resource locator
  • the preloading module executes and acquires the source code of the page in response to the trigger instruction
  • the preloading module may respond to the trigger instruction of opening the target applet page, and obtain the page source code corresponding to the target applet page, such as HTML source code, so as to further execute the first static resource request and static injection according to the page source code.
  • the page source code such as HTML source code
  • the preloading module analyzes the page source code to send the first static resource request to the resource request module
  • S24 is executed by the preloading module after obtaining the page source code in S23
  • S25 is executed by the resource requesting module after S24 sends the first static resource request to the resource requesting module.
  • the first static resource request refers to a request sent by the preloading module to the resource requesting module for requesting static resources required by the page source code.
  • the resource request module pre-obtains the corresponding static resource in response to the first static resource request
  • the resource request module can obtain the static resources required by the page source code based on a local preset resource package or a network request.
  • the application can prepare the required static resources in advance before the page is loaded.
  • the preloading module statically injects the preset code into the page source code and sends it to the container module;
  • the preloading module executes S26, and after S26 sends the successfully injected page source code to the container module, the container module executes S27.
  • the aforementioned preset code may be a reference code of a static resource, and after the page source code is statically injected into the preset code, the static resource required for reference can be directly loaded without repeatedly writing the code of these static resources.
  • the code to be injected can be directly written into the source code of the page through the Jsoup framework to complete the injection.
  • the application platform usually provides a static resource package in advance, which includes the code of a large number of static resources available to developers. Developers do not need to repeatedly write the static resources in the source code of the page, only through static injection. Reference these static resources.
  • the container module loads and injects the successfully injected page source code
  • the container module will wait for the static injection to succeed before loading.
  • the container module uses the interception technology to generate a second static resource request and sends it to the resource request module;
  • an interception technology is used to intercept static resource requests that need to be made during the loading process, and the request is handed over to the resource request module for processing.
  • the request can be intercepted through the shouldInterceptRequest method of the system webview.
  • the resource request module acquires the target static resource in response to the second static resource request.
  • the resource request module has obtained the static resources required by the page source code in advance based on the first static resource request. For example, you can cache static resources after making network requests. Therefore, during the page loading process, the time for the resource request module to obtain the target static resource is saved.
  • the resource request module returns the target static resource to the container module.
  • this embodiment optimizes the timing of container initialization and static resource requests, and does not need to wait until the container initialization is completed before starting to execute parsing pages and requesting static resources.
  • the timing of static resource requests is advanced, so that container initialization and static resource requests can be executed in parallel in two ways, so that the time for container initialization can be utilized; at the same time, through interception technology, resource package matching and request caching strategies are coordinated with resource presets , to achieve the purpose of optimizing the loading timing and speeding up the page opening speed.
  • first path S21-S22; the second path: S21-S23-S26/(S24-S25).
  • the second road can be further divided into the second road branch 1: S21-S23-S24-S25 and the second road branch 2: S21-S23-S26.
  • the above-mentioned first path and the second path may be executed in parallel, and the two branches S24-S25 and S26 of the second path are also two branches executed in parallel.
  • the aforementioned parallel execution does not require that each path or branch must start or end at the same time.
  • the container initialization of the first path may be completed relatively quickly. At this time, it is necessary to wait for the second branch 2 to return the successfully injected page source code before performing the subsequent page loading work.
  • container initialization that is, the first path: S21-S22
  • requesting static resources that is, the second path branch 1: S21-S23-S24-S25
  • static injection That is, the time spent on the second branch 2
  • T3 the time spent on loading the page
  • this solution adopts static injection technology, and the injection is completed through static injection before loading the page, and the timing of injection is advanced to ensure successful injection.
  • Fig. 3 is a schematic flowchart of a page loading method shown in another exemplary embodiment of the present invention. This embodiment further describes the processes of S24, S25, S26, and S29 in detail on the basis of the embodiment shown in Fig. 2 .
  • S24 may further include:
  • the preloading module analyzes the source code of the page through a preset parsing framework to obtain static resource dependencies therein.
  • the preloading module sends the first static resource request to the resource requesting module according to the static resource dependency.
  • the above static resource request is executed in parallel with container initialization. For example, after the resource preloading module obtains the HTML source code corresponding to the target applet page, it can parse the HTML page source code through the Jsoup framework, obtain the static resource dependencies, and request the corresponding resources through the resource request module.
  • S26 may further include:
  • the preloading module writes the preset code to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: the reference code of the static resource required by the page source code.
  • the preloading module sends the successfully injected page source code to the container module.
  • the above static injection is performed in parallel with container initialization. For example, after the preloading module obtains the HTML source code corresponding to the target applet page, it directly writes the code to be injected into the page source code through the Jsoup framework to complete the injection.
  • S25 may further include:
  • the resource request module receives the first static resource request, perform first resource matching in the preset resource package according to the first static resource request. If the first resource is successfully matched, no processing is required.
  • the resource request module will first match the preset resource package. If it misses, it will continue to match in the local network cache. If it still misses, it will send a network request. After the request is successful, the local network cache will be updated.
  • the aforementioned preset resource package refers to a preset static resource package, which can be delivered by the application server to the application client. Further, in order to update the local preset resource package in the application client, the method may further include: in response to the application start instruction, the application client sends an update request to the server to update the preset resource package.
  • the application client sends an update request to the server to update the preset resource package, which may also specifically include: the application client sends an update request carrying the characteristic value P1 of the local preset resource package to the server; The application client receives the difference package delivered by the server, which is generated based on the characteristic value P1 of the local preset resource package, the latest current resource package and its characteristic value P2; the application client combines the difference package and the local preset resource package Combine packages to get an updated pre-built resource package. In this way, an update with the same effect can be realized without sending the current latest resource package to the application client as a whole, saving resources.
  • the application server can also directly deliver the latest resource package to the application server to directly replace the client's local preset resource package, and the logic is simpler.
  • This application does not specifically limit the update method and update timing of the preset resource package.
  • the foregoing network request may include: a network request for service static resources and/or external static resources configured by the resource management platform of the server.
  • S29 may further include: when the resource request module receives the second static resource request, perform S291: Preset the resource package according to the second static resource request If the matching is successful, then directly execute S30: return the matched static resource to the container module; on the contrary, if the third resource is not successfully matched, then further execute S292: execute the fourth resource in the local network cache Matching; if the matching is successful, directly execute S30: return the matched static resource to the container module; on the contrary, if the matching of the fourth resource is still unsuccessful, further execute S293 and S294: send a network request to obtain the target static resource. And execute S303: return the target static resource to the container module.
  • the corresponding resource request will be intercepted and sent through the resource request module. Since the static resource request in the page has been sent in advance in the previous step, there are three situations at this time: 1. This resource belongs to the preset static resource, and the third resource matching can be directly matched and returned. 2. When the third resource is not matched, continue to match the fourth resource in the local network cache. If the first static resource request sent in advance in S25 is successful, it will be hit in the local network cache and returned directly . 3. When neither the third resource matching nor the fourth resource matching is a hit, it means that the first static resource request sent in advance in S25 has not been returned or the request failed. At this time, the network request can be made again to obtain the required network resources.
  • Fig. 4 shows a specific example of an embodiment of the present invention, which will be described exemplarily below in conjunction with Fig. 4 .
  • the applet container is also the above-mentioned container module, wherein the applet container, the preload module and the resource request module are loading components in the application client.
  • the resource management platform is located on the application server side and is mainly responsible for the configuration update of static resources on the business side.
  • the update of business static resources is mainly divided into two parts. One is the update of the client’s preset resource package.
  • the preset resource package mainly includes the general static resource files that the applet needs to use.
  • the key is the URL of the static resource, and the value is the specific value of the static resource. document.
  • the second is the update of business static resources, mainly including some business-related pictures and other resources.
  • the app executes: (1) App startup: After the app starts, it will request the resource management platform to send the characteristic value p1 of the local preset package. (2) Update the local preset package: After receiving the request, the preset package update module of the server-side resource management platform will generate a corresponding difference package according to the characteristic value p1 sent by the client, the latest current resource package and its characteristic value p2, and download hair. After the application client receives the differential package sent by the server, it combines the packages, and the preset package update process ends. (3) Container initialization: the user clicks the entry of the target applet, the framework gets the URL of the applet page, and the applet container starts to initialize.
  • the network requests here can be divided into two types, one is resource requests for business static resources configured on the resource management platform, and the other is external requests for external static resources.
  • the container loads the HTML page after the successful injection.
  • Page loading Enter the loading process.
  • This resource is a preset static resource, and the preset package is matched, and the hit is returned directly. 2. If the preset package misses, continue to match in the network cache. If the request sent in step (5) is successful, the hit will be returned directly. 3. If the first two cases are all missing, it means that the static resource request sent in advance in step (5) has not been returned or the request failed, and the external request can be sent directly.
  • first and second are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features.
  • the features defined as “first” and “second” may explicitly or implicitly include at least one of these features.
  • “plurality” means at least two, such as two, three, etc., unless otherwise specifically defined.
  • FIG. 1 is a schematic structural diagram of a page loading component provided by an embodiment of the present invention.
  • the loading assembly 10 includes:
  • a container module 11 configured to perform initialization in response to a trigger instruction
  • the preloading module 12 is used to execute in response to the trigger instruction: obtain the page source code; analyze the page source code to send the first static resource request to the resource request module, and send the page source code statically injected into the preset code to the container module;
  • the container module 11 is also used to load the successfully injected page source code, intercept the static resource request therein to send the second static resource request to the resource request module;
  • the resource request module 13 is configured to pre-acquire corresponding static resources in response to the first static resource request, and return the target static resource to the container module in response to the second static resource request.
  • the container module is an applet container.
  • the loading component is further configured to: send an update request to the server in response to the application start instruction, so as to update the preset resource package.
  • the loading component is also used to: send an update request carrying the characteristic value of the local preset resource package to the server; , the current latest resource package and its characteristic values; combine the difference package and the local preset resource package to obtain an updated preset resource package.
  • the container module is configured to obtain and initialize the uniform resource locator of the target applet page in response to a trigger instruction for opening the target applet page; in parallel, the preload module is configured to In response to the trigger instruction for opening the target applet page, the page source code corresponding to the target applet page is obtained, and the first static resource request and static injection are performed according to the page source code.
  • the preloading module is configured to: analyze the page source code through a preset parsing framework to obtain static resource dependencies therein; and send a first static resource request to the resource request module according to the static resource dependencies.
  • the preloading module is used to: write the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
  • the resource request module is configured to: when receiving the first static resource request, perform the first resource matching in the preset resource package according to the first static resource request; if the first resource matching fails, The second resource is matched in the local network cache; if the second resource is not matched successfully, a network request is sent to update the local network cache.
  • the resource request module is configured to: when receiving the second static resource request, perform third resource matching in the preset resource package according to the second static resource request; if the third resource matching is successful, then Return the matched static resource to the container module; if the third resource is not matched successfully, perform the fourth resource match in the local network cache; if the fourth resource is successfully matched, return the matched static resource to the container module; 4. If resource matching fails, a network request is sent to obtain the target static resource.
  • the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
  • page loading component in the embodiment of the present application can realize the various processes of the foregoing embodiments of the page loading method, and achieve the same effect and function, which will not be repeated here.
  • Fig. 5 is a page loading system according to an embodiment of the present application, including: an application client, which includes a page loading component as shown in Fig. 1; Configure resource packages and/or provide business static resources to application clients.
  • Fig. 6 is a page loading device according to an embodiment of the present application, which is used to execute the page loading method shown in the above embodiments, the device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores instructions executable by at least one processor, and the instructions are executed by at least one processor, so that the at least one processor can execute the methods of the above embodiments.
  • a non-volatile computer storage medium of a page loading method on which computer-executable instructions are stored, and the computer-executable instructions are configured to be executed when run by a processor: the above-mentioned embodiments method.
  • the device, device, and computer-readable storage medium provided in the embodiments of the present application correspond to the method one-to-one. Therefore, the device, device, and computer-readable storage medium also have beneficial technical effects similar to their corresponding methods.
  • the beneficial technical effect of the method has been described in detail, therefore, the beneficial technical effect of the device, equipment and computer-readable storage medium will not be repeated here.
  • the embodiments of the present invention may be provided as methods, systems or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM Electrically Erasable Programmable Read-

Abstract

A page loading method, an assembly, a system, an apparatus, and a computer-readable storage medium. The method comprises: a container module executing initialization in response to a trigger instruction; in response to a trigger instruction, a preloading module executing: obtaining a page source code; analyzing the page source code to generate a first static resource request and sending said request to a resource request module, and sending to the container module a page source code into which a preset code has been statically injected; the container module loading the successfully injected page source code, using interception technology to generate a second static resource request and sending said request to the resource request module; and in response to the first static resource request, the resource request module obtaining a corresponding static resource in advance, and, in response to the second static resource request, returning a target static resource to the container module. By using the aforementioned method, in one aspect, the timing of container initialization and static resource requests is optimized, and page opening speed is increased. In another aspect, the injection success rate is improved by means of adopting static injection technology.

Description

页面加载方法、组件、系统、装置及计算机可读存储介质Page loading method, component, system, device and computer-readable storage medium
本申请要求于2021年08月23日提交的、申请号为202110967875.9、标题为“页面加载方法、组件、系统、装置及计算机可读存储介质”的中国专利申请的优先权,该中国专利申请的公开内容以引用的方式并入本文。This application claims the priority of the Chinese patent application with application number 202110967875.9 and titled "Page loading method, component, system, device, and computer-readable storage medium" filed on August 23, 2021. The Chinese patent application The disclosure is incorporated herein by reference.
技术领域technical field
本发明属于网页领域,具体涉及一种页面加载方法、组件、系统、装置及计算机可读存储介质。The invention belongs to the field of web pages, and in particular relates to a page loading method, component, system, device and computer-readable storage medium.
背景技术Background technique
本部分旨在为权利要求书中陈述的本发明的实施方式提供背景或上下文。此处的描述不因为包括在本部分中就承认是现有技术。This section is intended to provide a background or context for implementations of the invention that are recited in the claims. The descriptions herein are not admitted to be prior art by inclusion in this section.
随着诸如“云闪付”等小程序功能上线,越来越多的外部接入方选择以小程序等方式接入业务,这对小程序接入便捷度及页面打开速度提出了更高的要求。现阶段外部接入方要接入业务,需要在自己的工程中依赖诸如“云闪付”等小程序的相关静态资源以减少接入方的工作量。With the launch of small program functions such as "Union QuickPass", more and more external access parties choose to access services through small programs, which puts higher demands on the convenience of accessing small programs and the speed of page opening. Require. At this stage, if the external access party wants to access the business, it needs to rely on the relevant static resources of small programs such as "Cloud QuickPass" in its own project to reduce the workload of the access party.
小程序页面打开一般分为三步:一是初始化小程序容器,二是解析页面、请求静态资源,三是进行页面加载渲染。一般来说,这三步由系统webview按串行逻辑依次执行,页面打开所需时间为三步耗时总和,此种方式下用户看到的加载白屏时间长。并且,现有小程序容器一般采用动态注入方案将相关静态资源的代码注入,也即在小程序页面加载的生命周期函数中进行代码注入,这样容易导致页面会出现逻辑错误,无法保证注入的成功率。The opening of the applet page is generally divided into three steps: one is to initialize the applet container, the other is to parse the page, request static resources, and the third is to load and render the page. Generally speaking, these three steps are executed sequentially by the system webview according to serial logic, and the time required to open the page is the sum of the three steps. In this way, the user sees a long loading white screen. Moreover, existing applet containers generally use a dynamic injection scheme to inject the code of related static resources, that is, code injection is performed in the lifecycle function of the applet page loading, which easily leads to logic errors on the page and cannot guarantee the success of the injection. Rate.
发明内容Contents of the invention
针对上述现有技术中存在的问题,提出了一种页面加载方法、组件、系统、装置及计算机可读存储介质,利用这种方法、装置及计算机可读存储介质,能够解决上述问题。Aiming at the problems existing in the above-mentioned prior art, a page loading method, component, system, device and computer-readable storage medium are proposed, and the above-mentioned problems can be solved by using the method, device and computer-readable storage medium.
本发明提供了以下方案。The present invention provides the following solutions.
第一方面,提供一种页面加载方法,其特征在于,应用于应用客户端,应用客户端包括容器模块、预加载模块和资源请求模块,方法包括:容器模块响应于触发指令执行初始化; 预加载模块响应于触发指令执行:获取页面源码;分析页面源码以生成第一静态资源请求并发送给资源请求模块,并向容器模块发送静态注入预设代码的页面源码;容器模块加载注入成功的页面源码,利用拦截技术生成第二静态资源请求并发送给资源请求模块;以及,资源请求模块响应于第一静态资源请求预先获取对应的静态资源,并响应于第二静态资源请求向容器模块返回目标静态资源。In the first aspect, there is provided a page loading method, which is characterized in that it is applied to an application client, and the application client includes a container module, a preload module and a resource request module, and the method includes: the container module executes initialization in response to a trigger instruction; preload The module executes in response to the trigger instruction: obtain the page source code; analyze the page source code to generate the first static resource request and send it to the resource request module, and send the page source code statically injected with the preset code to the container module; the container module loads the successfully injected page source code , using interception technology to generate a second static resource request and send it to the resource request module; and, the resource request module pre-obtains the corresponding static resource in response to the first static resource request, and returns the target static resource to the container module in response to the second static resource request resource.
在一种实施方式中,容器模块为小程序容器。In one embodiment, the container module is an applet container.
在一种实施方式中,方法还包括:响应于应用启动指令,应用客户端向服务端上送更新请求,以更新预置资源包。In one embodiment, the method further includes: in response to the application start instruction, the application client sends an update request to the server to update the preset resource package.
在一种实施方式中,应用客户端向服务端上送更新请求以更新预置资源包,还包括:应用客户端向服务端上送携带本地预置资源包特征值的更新请求;应用客户端接收服务端下发的差分包,差分包是根据本地预置资源包特征值、当前最新资源包及其特征值生成的;应用客户端将差分包和本地预置资源包进行合包,以获得更新后的预置资源包。In one embodiment, the application client sends an update request to the server to update the preset resource package, and further includes: the application client sends an update request carrying the characteristic value of the local preset resource package to the server; the application client sends an update request to the server; Receive the difference package sent by the server, the difference package is generated according to the characteristic value of the local preset resource package, the latest resource package and its characteristic value; the application client combines the difference package and the local preset resource package to obtain Updated pre-built resource packs.
在一种实施方式中,方法还包括:容器模块响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符并进行初始化;并行地,预加载模块响应于打开目标小程序页面的触发指令,获取目标小程序页面对应的页面源码,根据页面源码执行第一静态资源请求和静态注入。In one embodiment, the method further includes: the container module responds to the trigger instruction of opening the target applet page, acquires and initializes the uniform resource locator of the target applet page; in parallel, the preloading module responds to opening the target applet page The page trigger instruction obtains the page source code corresponding to the target applet page, and executes the first static resource request and static injection according to the page source code.
在一种实施方式中,方法还包括:预加载模块通过预设解析框架分析页面源码,获取其中的静态资源依赖;根据静态资源依赖向资源请求模块发送第一静态资源请求。In one embodiment, the method further includes: the preloading module analyzes the page source code through a preset parsing framework to obtain the static resource dependencies therein; and sends the first static resource request to the resource request module according to the static resource dependencies.
在一种实施方式中,方法还包括:预加载模块通过预设解析框架将需要注入的预设代码写入目标小程序页面对应的页面源码;预设代码包括:页面源码所需的静态资源的引用代码。In one embodiment, the method further includes: the preloading module writes the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
在一种实施方式中,资源请求模块响应于第一静态资源请求预先获取对应的静态资源,还包括:当资源请求模块接收到第一静态资源请求时,根据第一静态资源请求在预置资源包中进行第一资源匹配;若第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;若第二资源匹配未成功,则发送网络请求以更新本地网络缓存。In one embodiment, the resource requesting module pre-obtains the corresponding static resource in response to the first static resource request, and further includes: when the resource requesting module receives the first static resource request, presetting the resource according to the first static resource request The first resource matching is performed in the package; if the first resource matching is unsuccessful, the second resource matching is performed in the local network cache; if the second resource matching is unsuccessful, a network request is sent to update the local network cache.
在一种实施方式中,响应于第二静态资源请求向容器模块返回目标静态资源,包括:当资源请求模块接收到第二静态资源请求时,根据第二静态资源请求在预置资源包中进行第三资源匹配;若第三资源匹配成功,则将匹配到的静态资源返回容器模块;若第三资源匹配未成功,则在本地网络缓存中进行第四资源匹配;若第四资源匹配成功,则将匹配到的静态资源返回容器模块;若第四资源匹配未成功,则发送网络请求以获取目标静态资源。In one embodiment, returning the target static resource to the container module in response to the second static resource request includes: when the resource request module receives the second static resource request, performing The third resource is matched; if the third resource is successfully matched, the matched static resource is returned to the container module; if the third resource is not successfully matched, the fourth resource is matched in the local network cache; if the fourth resource is successfully matched, Then return the matched static resource to the container module; if the fourth resource is not matched successfully, send a network request to obtain the target static resource.
在一种实施方式中,网络请求包括:对资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。In an implementation manner, the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
第二方面,提供一种页面加载组件,其特征在于,应用于应用客户端,包括:容器模块,用于响应于触发指令执行初始化;预加载模块,用于响应于触发指令执行:获取页面源码;分析页面源码以向资源请求模块发送第一静态资源请求,并向容器模块发送静态注入预设代码的页面源码;容器模块,还用于加载注入成功的页面源码,拦截其中的静态资源请求以向资源请求模块发送第二静态资源请求;以及,资源请求模块,用于响应于第一静态资源请求预先获取对应的静态资源,以及响应于第二静态资源请求向容器模块返回目标静态资源。In a second aspect, a page loading component is provided, which is applied to an application client, including: a container module, configured to execute initialization in response to a trigger instruction; a preload module, configured to execute in response to the trigger instruction: obtain page source code ; Analyze the page source code to send the first static resource request to the resource request module, and send the page source code statically injected with the preset code to the container module; the container module is also used to load the successfully injected page source code, intercept the static resource request therein and Sending a second static resource request to the resource request module; and a resource request module, configured to pre-acquire corresponding static resources in response to the first static resource request, and return a target static resource to the container module in response to the second static resource request.
在一种实施方式中,容器模块为小程序容器。In one embodiment, the container module is an applet container.
在一种实施方式中,加载组件还用于:响应于应用启动指令,向服务端上送更新请求,以更新预置资源包。In one embodiment, the loading component is further configured to: send an update request to the server in response to the application start instruction, so as to update the preset resource package.
在一种实施方式中,加载组件还用于:向服务端上送携带本地预置资源包特征值的更新请求;接收服务端下发的差分包,差分包是根据本地预置资源包特征值、当前最新资源包及其特征值生成的;将差分包和本地预置资源包进行合包,以获得更新后的预置资源包。In one embodiment, the loading component is also used to: send an update request carrying the characteristic value of the local preset resource package to the server; , the current latest resource package and its characteristic values; combine the difference package and the local preset resource package to obtain an updated preset resource package.
在一种实施方式中,其特征在于,容器模块,用于响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符并进行初始化;并行地,预加载模块,用于响应于打开目标小程序页面的触发指令,获取目标小程序页面对应的页面源码,根据页面源码执行第一静态资源请求和静态注入。In one embodiment, it is characterized in that the container module is configured to obtain and initialize the uniform resource locator of the target applet page in response to a trigger instruction for opening the target applet page; in parallel, the preload module is configured to In response to the trigger instruction for opening the target applet page, the page source code corresponding to the target applet page is obtained, and the first static resource request and static injection are performed according to the page source code.
在一种实施方式中,预加载模块,用于:通过预设解析框架分析页面源码,获取其中的静态资源依赖;根据静态资源依赖向资源请求模块发送第一静态资源请求。In one embodiment, the preloading module is configured to: analyze the page source code through a preset parsing framework to obtain static resource dependencies therein; and send a first static resource request to the resource request module according to the static resource dependencies.
在一种实施方式中,预加载模块,用于:通过预设解析框架将需要注入的预设代码写入目标小程序页面对应的页面源码;预设代码包括:页面源码所需的静态资源的引用代码。In one embodiment, the preloading module is used to: write the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
在一种实施方式中,资源请求模块,用于:当接收到第一静态资源请求时,根据第一静态资源请求在预置资源包中进行第一资源匹配;若第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;若第二资源匹配未成功,则发送网络请求以更新本地网络缓存。In one embodiment, the resource request module is configured to: when receiving the first static resource request, perform the first resource matching in the preset resource package according to the first static resource request; if the first resource matching fails, The second resource is matched in the local network cache; if the second resource is not matched successfully, a network request is sent to update the local network cache.
在一种实施方式中,资源请求模块,用于:当接收到第二静态资源请求时,根据第二静态资源请求在预置资源包中进行第三资源匹配;若第三资源匹配成功,则将匹配到的静态资源返回容器模块;若第三资源匹配未成功,则在本地网络缓存中进行第四资源匹配;若第四资源匹配成功,则将匹配到的静态资源返回容器模块;若第四资源匹配未成功,则发送网络请求以获取目标静态资源。In one embodiment, the resource request module is configured to: when receiving the second static resource request, perform third resource matching in the preset resource package according to the second static resource request; if the third resource matching is successful, then Return the matched static resource to the container module; if the third resource is not matched successfully, perform the fourth resource match in the local network cache; if the fourth resource is successfully matched, return the matched static resource to the container module; 4. If resource matching fails, a network request is sent to obtain the target static resource.
在一种实施方式中,网络请求包括:对资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。In an implementation manner, the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
第三方面,提供一种页面加载系统,包括:应用客户端,其包含如第二方面的页面加载组件;应用服务端,其包含资源管理平台,用于向应用客户端下发更新预置资源包和/或用于向应用客户端提供业务静态资源。In the third aspect, a page loading system is provided, including: an application client, which includes the page loading component as in the second aspect; an application server, which includes a resource management platform, and is used to issue updated preset resources to the application client Package and/or used to provide business static resources to application clients.
第四方面,提供一种页面加载装置,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行:如第一方面的方法。In a fourth aspect, there is provided a page loading device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores instructions executable by at least one processor, and the instructions are processed by at least one processor executed by a processor, so that at least one processor can execute: the method of the first aspect.
第五方面,提供一种计算机可读存储介质,计算机可读存储介质存储有程序,当程序被多核处理器执行时,使得多核处理器执行如第一方面的方法。In a fifth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a program, and when the program is executed by a multi-core processor, the multi-core processor executes the method in the first aspect.
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:本实施例中,一方面优化了容器初始化与静态资源请求的时序,无需等到容器初始化完成之后再开始执行解析页面和请求静态资源等,达到优化加载时序、加快页面打开速度的目的。另一方面,本方案采用静态注入技术,在加载页面之前通过静态注入方式完成注入,注入时机提前,保证注入成功。The above-mentioned at least one technical solution adopted in the embodiment of the present application can achieve the following beneficial effects: In this embodiment, on the one hand, the timing of container initialization and static resource requests is optimized, and there is no need to wait until the container initialization is completed before starting to execute parsing pages and requesting static resources etc., to achieve the purpose of optimizing the loading timing and speeding up the page opening speed. On the other hand, this solution adopts static injection technology, and the injection is completed through static injection before loading the page, and the timing of injection is advanced to ensure successful injection.
应当理解,上述说明仅是本发明技术方案的概述,以便能够更清楚地了解本发明的技术手段,从而可依照说明书的内容予以实施。为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举例说明本发明的具体实施方式。It should be understood that the above description is only an overview of the technical solution of the present invention, so as to understand the technical means of the present invention more clearly, so as to be implemented according to the contents of the description. In order to make the above and other objects, features and advantages of the present invention more comprehensible, specific embodiments of the present invention are illustrated below.
附图说明Description of drawings
通过阅读下文的示例性实施例的详细描述,本领域普通技术人员将明白本文所述的优点和益处以及其他优点和益处。附图仅用于示出示例性实施例的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的标号表示相同的部件。在附图中:The advantages and benefits described herein, as well as other advantages and benefits, will be apparent to those of ordinary skill in the art upon reading the following detailed description of the exemplary embodiments. The drawings are only for the purpose of illustrating exemplary embodiments and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to denote the same parts. In the attached picture:
图1为根据本发明一实施例的页面加载组件的结构示意图;FIG. 1 is a schematic structural diagram of a page loading component according to an embodiment of the present invention;
图2为根据本发明一实施例的页面加载方法的流程示意图;FIG. 2 is a schematic flowchart of a page loading method according to an embodiment of the present invention;
图3为根据本发明另一实施例的页面加载方法的流程示意图;FIG. 3 is a schematic flowchart of a page loading method according to another embodiment of the present invention;
图4为根据本发明一实施例的页面加载示例的示意图;Fig. 4 is a schematic diagram of a page loading example according to an embodiment of the present invention;
图5为根据本发明一实施例的页面加载系统的结构示意图;FIG. 5 is a schematic structural diagram of a page loading system according to an embodiment of the present invention;
图6为根据本发明一实施例的页面加载组件的结构示意图。Fig. 6 is a schematic structural diagram of a page loading component according to an embodiment of the present invention.
在附图中,相同或对应的标号表示相同或对应的部分。In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
在本申请实施例的描述中,应理解,诸如“包括”或“具有”等术语旨在指示本说明书中所公开的特征、数字、步骤、行为、部件、部分或其组合的存在,并且不旨在排除一个或多个其他特征、数字、步骤、行为、部件、部分或其组合存在的可能性。In the description of the embodiments of the present application, it should be understood that terms such as "comprising" or "having" are intended to indicate the existence of the features, numbers, steps, acts, components, parts or combinations thereof disclosed in the specification, and do not It is intended to exclude the possibility of the existence of one or more other features, figures, steps, acts, parts, parts or combinations thereof.
除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。Unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this article is just an association relationship describing associated objects, indicating that there can be three relationships, For example, A and/or B may mean that A exists alone, A and B exist simultaneously, and B exists alone.
术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”等的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。The terms "first", "second", etc. are used for descriptive purposes only, and should not be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, a feature defined as "first", "second", etc. may expressly or implicitly include one or more of that feature. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
本申请中的所有代码都是示例性的,本领域技术人员根据所使用的编程语言,具体的需求和个人习惯等因素会在不脱离本申请的思想的条件下想到各种变型。All codes in this application are exemplary, and those skilled in the art will think of various modifications without departing from the idea of this application according to factors such as the programming language used, specific requirements, and personal habits.
为清楚阐述本申请实施例,首先将介绍一些后续实施例中可能会出现的概念。In order to clearly illustrate the embodiments of the present application, some concepts that may appear in subsequent embodiments will be introduced first.
静态资源(StaticResources),其包括js、css、img等非服务器动态运行生成的文件。Static resources (StaticResources), which include js, css, img and other files generated by non-server dynamic running.
另外还需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本发明。In addition, it should be noted that, in the case of no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and examples.
如图1所示,本申请提供的页面加载方法应用于应用客户端,比如可以是微信客户端,该应用客户端包括由容器模块11、预加载模块12和资源请求模块13组成的页面加载组件10。As shown in Figure 1, the page loading method provided by this application is applied to an application client, such as a WeChat client, and the application client includes a page loading component composed of a container module 11, a preload module 12 and a resource request module 13 10.
图2为根据本申请一实施例的页面加载方法的流程示意图,在该流程中,从设备角度而言,执行主体可以是一个或者多个电子设备;从程序角度而言,执行主体相应地可以是搭载于这些电子设备上的程序。在本实施例中,方法的执行主体可以是图1所示实施例中的页面加载组件。Fig. 2 is a schematic flow diagram of a page loading method according to an embodiment of the present application. In this flow, from a device point of view, the executing subject may be one or more electronic devices; from a program point of view, the executing subject may correspondingly It is a program installed on these electronic devices. In this embodiment, the execution subject of the method may be the page loading component in the embodiment shown in FIG. 1 .
如图2所示,本实施例提供的方法可以包括以下步骤:As shown in Figure 2, the method provided in this embodiment may include the following steps:
S21、容器模块和预加载模块接收到触发指令。S21. The container module and the preloading module receive a trigger instruction.
具体地,容器模块可以是小程序容器。该触发指令可以是打开目标小程序页面的触发指令。例如,用户点击目标小程序图标之后生成该触发指令。进一步地,容器模块和预加载模块接收到触发指令之后并行执行各自的动作,从而可以将原本串行执行的工作改变为并行执行。Specifically, the container module may be an applet container. The triggering instruction may be a triggering instruction for opening a target applet page. For example, the trigger instruction is generated after the user clicks on the target applet icon. Furthermore, after receiving the trigger instruction, the container module and the preloading module execute their respective actions in parallel, so that the work originally performed in series can be changed into parallel execution.
S22、容器模块响应于该触发指令执行初始化。S22. The container module executes initialization in response to the trigger instruction.
具体地,容器模块可以响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符(URL)并进行初始化。Specifically, the container module may, in response to a trigger instruction for opening the target applet page, acquire a uniform resource locator (URL) of the target applet page and perform initialization.
S23、预加载模块响应于该触发指令执行获取页面源码;S23. The preloading module executes and acquires the source code of the page in response to the trigger instruction;
具体地,预加载模块可以响应于打开目标小程序页面的触发指令,获取目标小程序页面对应的页面源码,比如HTML源码,从而进一步根据页面源码执行第一静态资源请求和静态注入。Specifically, the preloading module may respond to the trigger instruction of opening the target applet page, and obtain the page source code corresponding to the target applet page, such as HTML source code, so as to further execute the first static resource request and static injection according to the page source code.
S24、预加载模块分析页面源码以向资源请求模块发送第一静态资源请求;S24. The preloading module analyzes the page source code to send the first static resource request to the resource request module;
具体地,在S23获得页面源码之后即由预加载模块执行S24,并且在S24向资源请求模块发送第一静态资源请求之后即由资源请求模块执行S25。Specifically, S24 is executed by the preloading module after obtaining the page source code in S23, and S25 is executed by the resource requesting module after S24 sends the first static resource request to the resource requesting module.
第一静态资源请求是指由预加载模块发送给资源请求模块的、用于请求页面源码所需的静态资源的请求。The first static resource request refers to a request sent by the preloading module to the resource requesting module for requesting static resources required by the page source code.
S25、资源请求模块响应于第一静态资源请求预先获取对应的静态资源;S25. The resource request module pre-obtains the corresponding static resource in response to the first static resource request;
具体地,资源请求模块可以基于本地预置资源包或进行网络请求来获取该页面源码所需的静态资源。换言之,本申请在页面加载之前即可提前准备好所需的静态资源。Specifically, the resource request module can obtain the static resources required by the page source code based on a local preset resource package or a network request. In other words, the application can prepare the required static resources in advance before the page is loaded.
S26、预加载模块将预设代码静态注入页面源码后发送给容器模块;S26. The preloading module statically injects the preset code into the page source code and sends it to the container module;
具体地,在S23获得页面源码之后即由预加载模块执行S26,并且在S26向容器模块发送注入成功后的页面源码之后即由容器模块执行S27。Specifically, after the page source code is obtained in S23, the preloading module executes S26, and after S26 sends the successfully injected page source code to the container module, the container module executes S27.
上述预设代码可以是静态资源的引用代码,页面源码在静态注入该预设代码之后可以直接加载引用所需的静态资源,而无需重复编写这些静态资源的代码。例如,可以通过Jsoup框架将需要注入的代码直接写入页面源码,完成注入。可以理解,应用平台通常会预先提供静态资源包,其中包括可供开发者使用的大量静态资源的代码,开发者在页面源码时无需重复对该静态资源进行重复编写,只需要通过静态注入即可引用这些静态资源。The aforementioned preset code may be a reference code of a static resource, and after the page source code is statically injected into the preset code, the static resource required for reference can be directly loaded without repeatedly writing the code of these static resources. For example, the code to be injected can be directly written into the source code of the page through the Jsoup framework to complete the injection. It can be understood that the application platform usually provides a static resource package in advance, which includes the code of a large number of static resources available to developers. Developers do not need to repeatedly write the static resources in the source code of the page, only through static injection. Reference these static resources.
S27、容器模块加载注入成功的页面源码;S27. The container module loads and injects the successfully injected page source code;
具体地,在S22到S27之间可能存在时间间隔,若在静态注入完成之前,容器模块已经初始化完成,那么容器模块会等待静态注入成功之后再进行加载。Specifically, there may be a time interval between S22 and S27. If the container module has been initialized before the static injection is completed, the container module will wait for the static injection to succeed before loading.
S28、容器模块利用拦截技术生成第二静态资源请求并发送给资源请求模块;S28. The container module uses the interception technology to generate a second static resource request and sends it to the resource request module;
具体地,在页面加载过程中,会利用拦截技术来拦截加载过程中需要进行的静态资源请求,并交由资源请求模块处理。例如,可以通过系统webview的shouldInterceptRequest方法拦截请求。Specifically, during the page loading process, an interception technology is used to intercept static resource requests that need to be made during the loading process, and the request is handed over to the resource request module for processing. For example, the request can be intercepted through the shouldInterceptRequest method of the system webview.
S29、资源请求模块响应于第二静态资源请求获取目标静态资源。S29. The resource request module acquires the target static resource in response to the second static resource request.
具体地,在S25中,资源请求模块已经基于第一静态资源请求提前获取了页面源码所需的静态资源。例如,可以通过进行网络请求获取静态资源之后缓存。因此,在页面加载过程中,就节省了资源请求模块再去获取目标静态资源的时间。Specifically, in S25, the resource request module has obtained the static resources required by the page source code in advance based on the first static resource request. For example, you can cache static resources after making network requests. Therefore, during the page loading process, the time for the resource request module to obtain the target static resource is saved.
S30、资源请求模块向容器模块返回目标静态资源。S30. The resource request module returns the target static resource to the container module.
本实施例一方面优化了容器初始化与静态资源请求的时序,无需等到容器初始化完成之后再开始执行解析页面和请求静态资源等。而是将静态资源请求的时机前置,使得容器初始化与静态资源请求可以分两路并行执行,从而将容器初始化的时间利用起来;同时通过拦截技术,配合资源预置资源包匹配及请求缓存策略,达到优化加载时序、加快页面打开速度的目的。On the one hand, this embodiment optimizes the timing of container initialization and static resource requests, and does not need to wait until the container initialization is completed before starting to execute parsing pages and requesting static resources. Instead, the timing of static resource requests is advanced, so that container initialization and static resource requests can be executed in parallel in two ways, so that the time for container initialization can be utilized; at the same time, through interception technology, resource package matching and request caching strategies are coordinated with resource presets , to achieve the purpose of optimizing the loading timing and speeding up the page opening speed.
参考图2,假设第一路:S21—S22;第二路:S21-S23-S26/(S24-S25)。第二路可以进一步分为第二路分支1:S21-S23-S24-S25和第二路分支2:S21-S23-S26。上述第一路和第二路可以是并行执行的,第二路的两个分支S24-S25以及S26也是并行执行的两个分支。上述并行执行并不要求每一路或分支必须同时开始或同时结束。例如,第一路容器初始化可能完成的比较快,此时需等待第二路分支2返回注入成功的页面源码之后再执行后续的页面加载工作。Referring to Fig. 2, it is assumed that the first path: S21-S22; the second path: S21-S23-S26/(S24-S25). The second road can be further divided into the second road branch 1: S21-S23-S24-S25 and the second road branch 2: S21-S23-S26. The above-mentioned first path and the second path may be executed in parallel, and the two branches S24-S25 and S26 of the second path are also two branches executed in parallel. The aforementioned parallel execution does not require that each path or branch must start or end at the same time. For example, the container initialization of the first path may be completed relatively quickly. At this time, it is necessary to wait for the second branch 2 to return the successfully injected page source code before performing the subsequent page loading work.
基于此,假设容器初始化(也即第一路:S21—S22)耗费时间为T1,请求静态资源(也即第二路分支1:S21-S23-S24-S25)耗费时间为T2,静态注入(也即第二路分支2)耗费时间为T3,页面加载耗费时间为T4。由于上述第一路、第二路分支1、第二路分支2都是并行执行的,因此总耗费时间为T1、T2、T3中的最大值与T4之和。相较于传统串行执行方案所耗费时间更少。Based on this, assuming that container initialization (that is, the first path: S21-S22) takes time T1, and requesting static resources (that is, the second path branch 1: S21-S23-S24-S25) takes time T2, static injection ( That is, the time spent on the second branch 2) is T3, and the time spent on loading the page is T4. Since the first path, the second path branch 1, and the second path branch 2 are executed in parallel, the total time spent is the sum of the maximum value among T1, T2, and T3 and T4. Compared with the traditional serial execution scheme, it takes less time.
另一方面,本方案采用静态注入技术,在加载页面之前通过静态注入方式完成注入,注入时机提前,保证注入成功。On the other hand, this solution adopts static injection technology, and the injection is completed through static injection before loading the page, and the timing of injection is advanced to ensure successful injection.
图3是本发明另一示例性实施例示出的页面加载方法的流程示意图,本实施例在图2所示实施例的基础上,对S24、S25、S26、S29的过程进一步详细描述。Fig. 3 is a schematic flowchart of a page loading method shown in another exemplary embodiment of the present invention. This embodiment further describes the processes of S24, S25, S26, and S29 in detail on the basis of the embodiment shown in Fig. 2 .
在一种实施方式中,S24可以进一步包括:In one embodiment, S24 may further include:
S241、预加载模块通过预设解析框架分析页面源码,获取其中的静态资源依赖。S241. The preloading module analyzes the source code of the page through a preset parsing framework to obtain static resource dependencies therein.
S242、预加载模块根据静态资源依赖向资源请求模块发送第一静态资源请求。S242. The preloading module sends the first static resource request to the resource requesting module according to the static resource dependency.
上述静态资源请求与容器初始化并行执行。例如,资源预加载模块获取目标小程序页面对应的HTML源码后,可以通过Jsoup框架解析HTML页面源码,获取其中静态资源依赖,并通过资源请求模块请求对应资源。The above static resource request is executed in parallel with container initialization. For example, after the resource preloading module obtains the HTML source code corresponding to the target applet page, it can parse the HTML page source code through the Jsoup framework, obtain the static resource dependencies, and request the corresponding resources through the resource request module.
在一种实施方式中,S26可以进一步包括:In one embodiment, S26 may further include:
S261、预加载模块通过预设解析框架将需要注入的预设代码写入目标小程序页面对应的页面源码;该预设代码包括:页面源码所需的静态资源的引用代码。S261. The preloading module writes the preset code to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: the reference code of the static resource required by the page source code.
S262、预加载模块将注入成功的页面源码发送给容器模块。S262. The preloading module sends the successfully injected page source code to the container module.
上述静态注入与容器初始化并行执行。例如,预加载模块获取目标小程序页面对应的HTML源码后,通过Jsoup框架将需要注入的代码直接写入页面源码,完成注入。The above static injection is performed in parallel with container initialization. For example, after the preloading module obtains the HTML source code corresponding to the target applet page, it directly writes the code to be injected into the page source code through the Jsoup framework to complete the injection.
在一种实施方式中,S25可以进一步包括:In one embodiment, S25 may further include:
S251、当资源请求模块接收到第一静态资源请求时,根据第一静态资源请求在预置资源包中进行第一资源匹配。如第一资源匹配成功,则无需处理。S251. When the resource request module receives the first static resource request, perform first resource matching in the preset resource package according to the first static resource request. If the first resource is successfully matched, no processing is required.
S252、若第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;如第二资源匹配成功,则无需处理。S252. If the matching of the first resource is not successful, perform the matching of the second resource in the local network cache; if the matching of the second resource is successful, no processing is required.
S253、若第二资源匹配未成功,则发送网络请求;S253. If the second resource is not successfully matched, send a network request;
S254、接收返回的静态资源并更新本地网络缓存。S254. Receive the returned static resource and update the local network cache.
简言之,资源请求模块首先会进行预置资源包匹配,若未命中则继续去本地网络缓存中进行匹配,若仍未命中则发送网络请求,请求成功后更新本地网络缓存。In short, the resource request module will first match the preset resource package. If it misses, it will continue to match in the local network cache. If it still misses, it will send a network request. After the request is successful, the local network cache will be updated.
上述预置资源包是指预置的静态资源包,可以由应用服务端下发至该应用客户端中。进一步地,为了获得对应用客户端中本地的预置资源包进行更新,本方法还可以包括:响应于应用启动指令,应用客户端向服务端上送更新请求,以更新预置资源包。The aforementioned preset resource package refers to a preset static resource package, which can be delivered by the application server to the application client. Further, in order to update the local preset resource package in the application client, the method may further include: in response to the application start instruction, the application client sends an update request to the server to update the preset resource package.
在一种实施方式中,应用客户端向服务端上送更新请求以更新预置资源包,还可以具体包括:应用客户端向服务端上送携带本地预置资源包特征值P1的更新请求;应用客户端接收服务端下发的差分包,该差分包是根据本地预置资源包特征值P1、当前最新资源包及其特征值P2生成的;应用客户端将差分包和本地预置资源包进行合包,以获得更新后的预置资源包。由此,无需将当前最近资源包整体下发至应用客户端,即可实现同等效果的更新,节省资源。In one embodiment, the application client sends an update request to the server to update the preset resource package, which may also specifically include: the application client sends an update request carrying the characteristic value P1 of the local preset resource package to the server; The application client receives the difference package delivered by the server, which is generated based on the characteristic value P1 of the local preset resource package, the latest current resource package and its characteristic value P2; the application client combines the difference package and the local preset resource package Combine packages to get an updated pre-built resource package. In this way, an update with the same effect can be realized without sending the current latest resource package to the application client as a whole, saving resources.
当然也可以由应用服务端将当前最新资源包直接下发至该应用服务端,以直接替代该客户端本地的预置资源包,逻辑更为简单。本申请对预置资源包的更新方式、更新时机不作具体限制。Of course, the application server can also directly deliver the latest resource package to the application server to directly replace the client's local preset resource package, and the logic is simpler. This application does not specifically limit the update method and update timing of the preset resource package.
上述网络请求可以包括:对服务端的资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。The foregoing network request may include: a network request for service static resources and/or external static resources configured by the resource management platform of the server.
在一种实施方式中,进一步描述页面加载过程中的静态资源请求,S29可以进一步包括:当资源请求模块接收到第二静态资源请求时,执行S291:根据第二静态资源请求在预置资源包中进行第三资源匹配;若匹配成功,则直接执行S30:将匹配到的静态资源返回容器模块;相反,若第三资源匹配未成功,则进一步执行S292:在本地网络缓存中进行第四资源匹配;若匹配成功,则直接执行S30:将匹配到的静态资源返回容器模块;相反,若第四资源匹配仍未成功,则进一步执行S293和S294:发送网络请求以获取目标静态资源。并将以及执行S303:将目标静态资源返回容器模块。In one embodiment, to further describe the static resource request in the page loading process, S29 may further include: when the resource request module receives the second static resource request, perform S291: Preset the resource package according to the second static resource request If the matching is successful, then directly execute S30: return the matched static resource to the container module; on the contrary, if the third resource is not successfully matched, then further execute S292: execute the fourth resource in the local network cache Matching; if the matching is successful, directly execute S30: return the matched static resource to the container module; on the contrary, if the matching of the fourth resource is still unsuccessful, further execute S293 and S294: send a network request to obtain the target static resource. And execute S303: return the target static resource to the container module.
换言之,页面加载过程中发现需要请求静态资源时,会拦截对应资源请求,通过资源请求模块发送。由于上一步已经提前发送页面中的静态资源请求,此时存在三种情况:1、此资源属于预置静态资源,第三资源匹配可以直接匹配到并返回。2、当第三资源匹配未命中时,继续去本地网络缓存中进行第四资源匹配,若此时S25中提前发送的第一静态资源请求已成功,则会在本地网络缓存中命中并直接返回。3、当第三资源匹配和第四资源匹配均未命中时,说明S25中提前发送的第一静态资源请求仍未返回或请求失败,此时可以再次提起网络请求以获取所需的网络资源。In other words, when it is found that a static resource needs to be requested during the page loading process, the corresponding resource request will be intercepted and sent through the resource request module. Since the static resource request in the page has been sent in advance in the previous step, there are three situations at this time: 1. This resource belongs to the preset static resource, and the third resource matching can be directly matched and returned. 2. When the third resource is not matched, continue to match the fourth resource in the local network cache. If the first static resource request sent in advance in S25 is successful, it will be hit in the local network cache and returned directly . 3. When neither the third resource matching nor the fourth resource matching is a hit, it means that the first static resource request sent in advance in S25 has not been returned or the request failed. At this time, the network request can be made again to obtain the required network resources.
图4示出本发明实施例的一个具体示例,以下结合图4进行示例性描述。其中小程序容器也即上述的容器模块,其中小程序容器、预加载模块和资源请求模块是应用客户端中的加载组件。资源管理平台位于应用服务端,主要负责业务侧静态资源的配置更新。业务静态资源更新主要分为两部分,一是客户端预置资源包的更新,预置资源包主要包括小程序需要使用的通用的静态资源文件,key为该静态资源url,value为静态资源具体文件。二是业务静态资源更新,主要包括一些业务相关的图片等资源。Fig. 4 shows a specific example of an embodiment of the present invention, which will be described exemplarily below in conjunction with Fig. 4 . The applet container is also the above-mentioned container module, wherein the applet container, the preload module and the resource request module are loading components in the application client. The resource management platform is located on the application server side and is mainly responsible for the configuration update of static resources on the business side. The update of business static resources is mainly divided into two parts. One is the update of the client’s preset resource package. The preset resource package mainly includes the general static resource files that the applet needs to use. The key is the URL of the static resource, and the value is the specific value of the static resource. document. The second is the update of business static resources, mainly including some business-related pictures and other resources.
参考图4,其中执行:(1)app启动:app启动后会请求资源管理平台,上送本地预置包特征值p1。(2)更新本地预置包:服务端资源管理平台的预置包更新模块收到请求后会根据客户端上送特征值p1、当前最新资源包及其特征值p2生成对应的差分包并下发。应用客户端接收到服务端下发的差分包后进行合包,预置包更新流程结束。(3)容器初始化:用户点击目标小程序入口,框架获取到小程序页面url,小程序容器开始初始化。(4)请求HTML中的静态资源:其与小程序容器初始化并行,预加载模块获取目标小程序页面对应的html源码后,通过Jsoup框架分析页面代码,获取其中静态资源依赖,并通过资源请求模块请求对应资源;(5)静态资源匹配:资源请求模块首先会进行预置包(也即预置资源包)匹配,若命中则不处理;若未命中则继续去缓存中进行匹配,若命中则不处理;若未命中则发送网 络请求,请求成功后更新缓存。此处网络请求可以分为两种,一是面向资源管理平台配置的业务静态资源的资源请求,二是面向外部静态资源的外部请求。(6)修改HTML,静态注入修改内容:其同样与小程序初始化并行,资源预加载模块获取目标小程序页面对应的html源码后,通过Jsoup框架将需要注入的代码直接写入页面源码,完成注入,若在此之前小程序容器已初始化成功,则小程序容器会等待静态注入成功后再继续执行。(7)小程序容器加载修改后的HTML:静态注入成功之后,小程序容器获取修改后的html,进入加载流程,此时容器加载的就是注入成功之后的html页面。(8)页面加载:进入加载流程,页面加载过程中发现需要请求静态资源时,会拦截对应资源请求,发送给资源请求模块处理,由于上一步已经提前发送HTML页面中的静态资源请求,此时存在三种情况:1、此资源属于预置静态资源,进行预置包匹配,命中直接返回。2、预置包未命中,继续去网络缓存中进行匹配,若此时第(5)步中发送的请求已成功,则命中直接返回。3、前两种情况全未命中,说明第(5)步提前发送的静态资源请求或仍未返回或请求失败,可以直接发送外部请求。Referring to FIG. 4 , it executes: (1) App startup: After the app starts, it will request the resource management platform to send the characteristic value p1 of the local preset package. (2) Update the local preset package: After receiving the request, the preset package update module of the server-side resource management platform will generate a corresponding difference package according to the characteristic value p1 sent by the client, the latest current resource package and its characteristic value p2, and download hair. After the application client receives the differential package sent by the server, it combines the packages, and the preset package update process ends. (3) Container initialization: the user clicks the entry of the target applet, the framework gets the URL of the applet page, and the applet container starts to initialize. (4) Request static resources in HTML: It is parallel to the initialization of the applet container. After the preloading module obtains the html source code corresponding to the target applet page, it analyzes the page code through the Jsoup framework, obtains the static resource dependencies, and uses the resource request module Request the corresponding resource; (5) Static resource matching: the resource request module will first match the preset package (that is, the preset resource package), if it is hit, it will not be processed; if it is not hit, it will continue to match in the cache, if it is hit, it will No processing; if there is a miss, a network request is sent, and the cache is updated after the request succeeds. The network requests here can be divided into two types, one is resource requests for business static resources configured on the resource management platform, and the other is external requests for external static resources. (6) Modify the HTML and statically inject the modified content: it is also parallel to the initialization of the applet. After the resource preloading module obtains the html source code corresponding to the target applet page, it directly writes the code to be injected into the page source code through the Jsoup framework to complete the injection , if the applet container has been initialized successfully before then, the applet container will wait for the static injection to succeed before continuing to execute. (7) The applet container loads the modified HTML: After the static injection is successful, the applet container obtains the modified HTML and enters the loading process. At this time, the container loads the HTML page after the successful injection. (8) Page loading: Enter the loading process. When it is found that a static resource needs to be requested during the page loading process, the corresponding resource request will be intercepted and sent to the resource request module for processing. Since the static resource request in the HTML page has been sent in advance in the previous step, at this time There are three situations: 1. This resource is a preset static resource, and the preset package is matched, and the hit is returned directly. 2. If the preset package misses, continue to match in the network cache. If the request sent in step (5) is successful, the hit will be returned directly. 3. If the first two cases are all missing, it means that the static resource request sent in advance in step (5) has not been returned or the request failed, and the external request can be sent directly.
在本说明书的描述中,参考术语“一些可能的实施方式”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, descriptions referring to the terms "some possible implementations", "some embodiments", "examples", "specific examples", or "some examples" mean that the descriptions described in conjunction with the embodiments or examples A particular feature, structure, material, or characteristic is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the described specific features, structures, materials or characteristics may be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine different embodiments or examples and features of different embodiments or examples described in this specification without conflicting with each other.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本发明的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of these features. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method descriptions in flowcharts or otherwise described herein may be understood to represent modules, segments or portions of code comprising one or more executable instructions for implementing specific logical functions or steps of the process , and the scope of preferred embodiments of the invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order depending on the functions involved, which shall It is understood by those skilled in the art to which the embodiments of the present invention pertain.
关于本申请实施例的方法流程图,将某些操作描述为以一定顺序执行的不同的步骤。这样的流程图属于说明性的而非限制性的。可以将在本文中所描述的某些步骤分组在一起并且在单个操作中执行、可以将某些步骤分割成多个子步骤、并且可以以不同于在本文中所示 出的顺序来执行某些步骤。可以由任何电路结构和/或有形机制(例如,由在计算机设备上运行的软件、硬件(例如,处理器或芯片实现的逻辑功能)等、和/或其任何组合)以任何方式来实现在流程图中所示出的各个步骤。Regarding the method flow chart of the embodiment of the present application, certain operations are described as different steps performed in a certain order. Such flowcharts are illustrative and not restrictive. Certain steps described herein can be grouped together and performed in a single operation, can be divided into multiple sub-steps, and can be performed in an order different than that shown herein . It can be implemented in any way by any circuit structure and/or tangible mechanism (for example, by software running on a computer device, hardware (for example, logical functions implemented by a processor or a chip), etc., and/or any combination thereof). The individual steps shown in the flowchart.
基于相同的技术构思,本发明实施例还提供一种页面加载组件,应用于应用客户端,用于执行上述任一实施例所提供的页面加载方法。图1为本发明实施例提供的一种页面加载组件结构示意图。Based on the same technical idea, an embodiment of the present invention also provides a page loading component, which is applied to an application client and used to execute the page loading method provided in any one of the above embodiments. FIG. 1 is a schematic structural diagram of a page loading component provided by an embodiment of the present invention.
如图1所示,加载组件10包括:As shown in Figure 1, the loading assembly 10 includes:
容器模块11,用于响应于触发指令执行初始化;A container module 11, configured to perform initialization in response to a trigger instruction;
预加载模块12,用于响应于触发指令执行:获取页面源码;分析页面源码以向资源请求模块发送第一静态资源请求,并向容器模块发送静态注入预设代码的页面源码;The preloading module 12 is used to execute in response to the trigger instruction: obtain the page source code; analyze the page source code to send the first static resource request to the resource request module, and send the page source code statically injected into the preset code to the container module;
容器模块11,还用于加载注入成功的页面源码,拦截其中的静态资源请求以向资源请求模块发送第二静态资源请求;以及,The container module 11 is also used to load the successfully injected page source code, intercept the static resource request therein to send the second static resource request to the resource request module; and,
资源请求模块13,用于响应于第一静态资源请求预先获取对应的静态资源,以及响应于第二静态资源请求向容器模块返回目标静态资源。The resource request module 13 is configured to pre-acquire corresponding static resources in response to the first static resource request, and return the target static resource to the container module in response to the second static resource request.
在一种实施方式中,容器模块为小程序容器。In one embodiment, the container module is an applet container.
在一种实施方式中,加载组件还用于:响应于应用启动指令,向服务端上送更新请求,以更新预置资源包。In one embodiment, the loading component is further configured to: send an update request to the server in response to the application start instruction, so as to update the preset resource package.
在一种实施方式中,加载组件还用于:向服务端上送携带本地预置资源包特征值的更新请求;接收服务端下发的差分包,差分包是根据本地预置资源包特征值、当前最新资源包及其特征值生成的;将差分包和本地预置资源包进行合包,以获得更新后的预置资源包。In one embodiment, the loading component is also used to: send an update request carrying the characteristic value of the local preset resource package to the server; , the current latest resource package and its characteristic values; combine the difference package and the local preset resource package to obtain an updated preset resource package.
在一种实施方式中,其特征在于,容器模块,用于响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符并进行初始化;并行地,预加载模块,用于响应于打开目标小程序页面的触发指令,获取目标小程序页面对应的页面源码,根据页面源码执行第一静态资源请求和静态注入。In one embodiment, it is characterized in that the container module is configured to obtain and initialize the uniform resource locator of the target applet page in response to a trigger instruction for opening the target applet page; in parallel, the preload module is configured to In response to the trigger instruction for opening the target applet page, the page source code corresponding to the target applet page is obtained, and the first static resource request and static injection are performed according to the page source code.
在一种实施方式中,预加载模块,用于:通过预设解析框架分析页面源码,获取其中的静态资源依赖;根据静态资源依赖向资源请求模块发送第一静态资源请求。In one embodiment, the preloading module is configured to: analyze the page source code through a preset parsing framework to obtain static resource dependencies therein; and send a first static resource request to the resource request module according to the static resource dependencies.
在一种实施方式中,预加载模块,用于:通过预设解析框架将需要注入的预设代码写入目标小程序页面对应的页面源码;预设代码包括:页面源码所需的静态资源的引用代码。In one embodiment, the preloading module is used to: write the preset code that needs to be injected into the page source code corresponding to the target applet page through the preset parsing framework; the preset code includes: static resources required by the page source code Quote code.
在一种实施方式中,资源请求模块,用于:当接收到第一静态资源请求时,根据第一静态资源请求在预置资源包中进行第一资源匹配;若第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;若第二资源匹配未成功,则发送网络请求以更新本地网络缓存。In one embodiment, the resource request module is configured to: when receiving the first static resource request, perform the first resource matching in the preset resource package according to the first static resource request; if the first resource matching fails, The second resource is matched in the local network cache; if the second resource is not matched successfully, a network request is sent to update the local network cache.
在一种实施方式中,资源请求模块,用于:当接收到第二静态资源请求时,根据第二静态资源请求在预置资源包中进行第三资源匹配;若第三资源匹配成功,则将匹配到的静态资源返回容器模块;若第三资源匹配未成功,则在本地网络缓存中进行第四资源匹配;若第四资源匹配成功,则将匹配到的静态资源返回容器模块;若第四资源匹配未成功,则发送网络请求以获取目标静态资源。In one embodiment, the resource request module is configured to: when receiving the second static resource request, perform third resource matching in the preset resource package according to the second static resource request; if the third resource matching is successful, then Return the matched static resource to the container module; if the third resource is not matched successfully, perform the fourth resource match in the local network cache; if the fourth resource is successfully matched, return the matched static resource to the container module; 4. If resource matching fails, a network request is sent to obtain the target static resource.
在一种实施方式中,网络请求包括:对资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。In an implementation manner, the network request includes: a network request for service static resources and/or external static resources configured by the resource management platform.
需要说明的是,本申请实施例中的页面加载组件可以实现前述页面加载方法的实施例的各个过程,并达到相同的效果和功能,这里不再赘述。It should be noted that the page loading component in the embodiment of the present application can realize the various processes of the foregoing embodiments of the page loading method, and achieve the same effect and function, which will not be repeated here.
图5为根据本申请一实施例的页面加载系统,包括:应用客户端,其包含如图1的页面加载组件;应用服务端,其包含资源管理平台,用于向应用客户端下发更新预置资源包和/或用于向应用客户端提供业务静态资源。Fig. 5 is a page loading system according to an embodiment of the present application, including: an application client, which includes a page loading component as shown in Fig. 1; Configure resource packages and/or provide business static resources to application clients.
图6为根据本申请一实施例的页面加载装置,用于执行以上实施例所示出的页面加载方法,该装置包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述实施例的方法。Fig. 6 is a page loading device according to an embodiment of the present application, which is used to execute the page loading method shown in the above embodiments, the device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores instructions executable by at least one processor, and the instructions are executed by at least one processor, so that the at least one processor can execute the methods of the above embodiments.
根据本申请的一些实施例,提供了页面加载方法的非易失性计算机存储介质,其上存储有计算机可执行指令,该计算机可执行指令设置为在由处理器运行时执行:上述实施例的方法。According to some embodiments of the present application, a non-volatile computer storage medium of a page loading method is provided, on which computer-executable instructions are stored, and the computer-executable instructions are configured to be executed when run by a processor: the above-mentioned embodiments method.
本申请中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、设备和计算机可读存储介质实施例而言,由于其基本相似于方法实施例,所以其描述进行了简化,相关之处可参见方法实施例的部分说明即可。Each embodiment in the present application is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the apparatus, equipment and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, their descriptions are simplified, and for relevant parts, please refer to part of the description of the method embodiments.
本申请实施例提供的装置、设备和计算机可读存储介质与方法是一一对应的,因此,装置、设备和计算机可读存储介质也具有与其对应的方法类似的有益技术效果,由于上面已经对方法的有益技术效果进行了详细说明,因此,这里不再赘述装置、设备和计算机可读存储介质的有益技术效果。The device, device, and computer-readable storage medium provided in the embodiments of the present application correspond to the method one-to-one. Therefore, the device, device, and computer-readable storage medium also have beneficial technical effects similar to their corresponding methods. The beneficial technical effect of the method has been described in detail, therefore, the beneficial technical effect of the device, equipment and computer-readable storage medium will not be repeated here.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。此外,尽管在附图中以特定顺序描述了本发明方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. In addition, while operations of the methods of the present invention are depicted in the figures in a particular order, there is no requirement or implication that these operations must be performed in that particular order, or that all illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution.
虽然已经参考若干具体实施方式描述了本发明的精神和原理,但是应该理解,本发明并不限于所公开的具体实施方式,对各方面的划分也不意味着这些方面中的特征不能组合以进行受益,这种划分仅是为了表述的方便。本发明旨在涵盖所附权利要求的精神和范围内所包括的各种修改和等同布置。Although the spirit and principles of the invention have been described with reference to a number of specific embodiments, it should be understood that the invention is not limited to the specific embodiments disclosed, nor does division of aspects imply that features in these aspects cannot be combined to achieve optimal performance. Benefit, this division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (23)

  1. 一种页面加载方法,其特征在于,应用于应用客户端,所述应用客户端包括容器模块、预加载模块和资源请求模块,所述方法包括:A page loading method, characterized in that it is applied to an application client, and the application client includes a container module, a preload module and a resource request module, and the method includes:
    所述容器模块响应于触发指令执行初始化;the container module performs initialization in response to a trigger instruction;
    所述预加载模块响应于所述触发指令执行:获取页面源码;分析所述页面源码以生成第一静态资源请求并发送给所述资源请求模块,并向所述容器模块发送静态注入预设代码的所述页面源码;The preloading module executes in response to the trigger instruction: obtaining the page source code; analyzing the page source code to generate a first static resource request and sending it to the resource request module, and sending a static injection preset code to the container module The source code of the page;
    所述容器模块加载注入成功的所述页面源码,利用拦截技术生成第二静态资源请求并发送给所述资源请求模块;以及,The container module loads the successfully injected page source code, uses interception technology to generate a second static resource request and sends it to the resource request module; and,
    所述资源请求模块响应于所述第一静态资源请求预先获取对应的静态资源,并响应于所述第二静态资源请求向所述容器模块返回目标静态资源。The resource request module pre-obtains a corresponding static resource in response to the first static resource request, and returns a target static resource to the container module in response to the second static resource request.
  2. 根据权利要求1所述的方法,其特征在于,所述容器模块为小程序容器。The method according to claim 1, wherein the container module is an applet container.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:The method according to claim 1 or 2, characterized in that the method further comprises:
    响应于应用启动指令,所述应用客户端向服务端上送更新请求,以更新预置资源包。In response to the application start instruction, the application client sends an update request to the server to update the preset resource package.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述应用客户端向服务端上送更新请求以更新预置资源包,还包括:The method according to any one of claims 1-3, wherein the application client sends an update request to the server to update the preset resource package, further comprising:
    所述应用客户端向服务端上送携带本地预置资源包特征值的更新请求;The application client sends an update request carrying the characteristic value of the local preset resource package to the server;
    所述应用客户端接收服务端下发的差分包,所述差分包是根据所述本地预置资源包特征值、当前最新资源包及其特征值生成的;The application client receives a differential packet sent by the server, and the differential packet is generated according to the characteristic value of the local preset resource packet, the latest current resource packet and its characteristic value;
    所述应用客户端将所述差分包和所述本地预置资源包进行合包,以获得更新后的预置资源包。The application client combines the difference package and the local preset resource package to obtain an updated preset resource package.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-4, wherein the method further comprises:
    所述容器模块响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符并进行初始化;并行地,The container module obtains and initializes the uniform resource locator of the target applet page in response to the trigger instruction of opening the target applet page; in parallel,
    所述预加载模块响应于打开目标小程序页面的触发指令,获取所述目标小程序页面对应的页面源码,根据所述页面源码执行所述第一静态资源请求和所述静态注入。The preloading module obtains the page source code corresponding to the target applet page in response to the trigger instruction of opening the target applet page, and executes the first static resource request and the static injection according to the page source code.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-5, wherein the method further comprises:
    所述预加载模块通过预设解析框架分析所述页面源码,获取其中的静态资源依赖;The preloading module analyzes the source code of the page through a preset parsing framework to obtain the static resource dependencies therein;
    根据所述静态资源依赖向所述资源请求模块发送所述第一静态资源请求。Sending the first static resource request to the resource request module according to the static resource dependency.
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-6, wherein the method further comprises:
    所述预加载模块通过所述预设解析框架将需要注入的预设代码写入所述目标小程序页面对应的所述页面源码;The preloading module writes the preset code to be injected into the page source code corresponding to the target applet page through the preset parsing framework;
    所述预设代码包括:所述页面源码所需的静态资源的引用代码。The preset code includes: the reference code of the static resource required by the page source code.
  8. 根据权利要求1-7中任一项所述的方法,其特征在于,所述资源请求模块响应于所述第一静态资源请求预先获取对应的静态资源,还包括:The method according to any one of claims 1-7, wherein the resource requesting module pre-acquires corresponding static resources in response to the first static resource request, further comprising:
    当所述资源请求模块接收到所述第一静态资源请求时,根据所述第一静态资源请求在预置资源包中进行第一资源匹配;When the resource request module receives the first static resource request, perform first resource matching in the preset resource package according to the first static resource request;
    若所述第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;If the first resource matching is not successful, then perform second resource matching in the local network cache;
    若所述第二资源匹配未成功,则发送网络请求以更新所述本地网络缓存。If the second resource is not matched successfully, a network request is sent to update the local network cache.
  9. 根据权利要求1-8中任一项所述的方法,响应于所述第二静态资源请求向所述容器模块返回目标静态资源,包括:According to the method according to any one of claims 1-8, returning the target static resource to the container module in response to the second static resource request comprises:
    当所述资源请求模块接收到所述第二静态资源请求时,根据所述第二静态资源请求在所述预置资源包中进行第三资源匹配;When the resource request module receives the second static resource request, perform third resource matching in the preset resource package according to the second static resource request;
    若所述第三资源匹配成功,则将匹配到的静态资源返回所述容器模块;If the third resource is successfully matched, returning the matched static resource to the container module;
    若所述第三资源匹配未成功,则在本地网络缓存中进行第四资源匹配;If the matching of the third resource is not successful, performing fourth resource matching in the local network cache;
    若所述第四资源匹配成功,则将匹配到的静态资源返回所述容器模块;If the matching of the fourth resource is successful, returning the matched static resource to the container module;
    若所述第四资源匹配未成功,则发送网络请求以获取所述目标静态资源。If the matching of the fourth resource is unsuccessful, a network request is sent to obtain the target static resource.
  10. 根据权利要求1-9中任一项所述的方法,其特征在于,所述网络请求包括:The method according to any one of claims 1-9, wherein the network request includes:
    对资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。Network requests for business static resources and/or external static resources configured on the resource management platform.
  11. 一种页面加载组件,其特征在于,应用于应用客户端,包括:A page loading component is characterized in that it is applied to an application client, including:
    容器模块,用于响应于触发指令执行初始化;a container module for performing initialization in response to a trigger instruction;
    预加载模块,用于响应于所述触发指令执行:获取页面源码;分析所述页面源码以向所述资源请求模块发送第一静态资源请求,并向所述容器模块发送静态注入预设代码的所述页面源码;A preloading module, configured to execute in response to the trigger instruction: obtain the page source code; analyze the page source code to send a first static resource request to the resource request module, and send a statically injected preset code request to the container module The source code of the page;
    所述容器模块,还用于加载注入成功的所述页面源码,拦截其中的静态资源请求以向所述资源请求模块发送第二静态资源请求;以及,The container module is further configured to load the successfully injected page source code, intercept the static resource request therein to send a second static resource request to the resource request module; and,
    所述资源请求模块,用于响应于所述第一静态资源请求预先获取对应的静态资源,以及响应于所述第二静态资源请求向所述容器模块返回目标静态资源。The resource request module is configured to pre-acquire corresponding static resources in response to the first static resource request, and return a target static resource to the container module in response to the second static resource request.
  12. 根据权利要求11所述的加载组件,其特征在于,所述容器模块为小程序容器。The loading component according to claim 11, wherein the container module is an applet container.
  13. 根据权利要求11或12所述的加载组件,其特征在于,所述加载组件还用于:The loading assembly according to claim 11 or 12, wherein the loading assembly is also used for:
    响应于应用启动指令,向服务端上送更新请求,以更新预置资源包。In response to the application start instruction, an update request is sent to the server to update the preset resource package.
  14. 根据权利要求11-13中任一项所述的加载组件,其特征在于,所述加载组件还用于:The loading assembly according to any one of claims 11-13, wherein the loading assembly is also used for:
    向服务端上送携带本地预置资源包特征值的更新请求;Send an update request carrying the characteristic value of the local preset resource package to the server;
    接收服务端下发的差分包,所述差分包是根据所述本地预置资源包特征值、当前最新资源包及其特征值生成的;receiving a differential packet sent by the server, the differential packet is generated according to the characteristic value of the locally preset resource packet, the latest current resource packet and its characteristic value;
    将所述差分包和所述本地预置资源包进行合包,以获得更新后的预置资源包。Combine the difference package and the local preset resource package to obtain an updated preset resource package.
  15. 根据权利要求11-14中任一项所述的加载组件,其特征在于,The loading assembly according to any one of claims 11-14, characterized in that,
    所述容器模块,用于响应于打开目标小程序页面的触发指令,获取目标小程序页面的统一资源定位符并进行初始化;并行地,The container module is configured to, in response to a trigger instruction for opening the target applet page, obtain and initialize the uniform resource locator of the target applet page; in parallel,
    所述预加载模块,用于响应于打开目标小程序页面的触发指令,获取所述目标小程序页面对应的页面源码,根据所述页面源码执行所述第一静态资源请求和所述静态注入。The preloading module is configured to, in response to a trigger instruction for opening a target applet page, obtain the page source code corresponding to the target applet page, and execute the first static resource request and the static injection according to the page source code.
  16. 根据权利要求11-15中任一项所述的加载组件,其特征在于,所述预加载模块,用于:The loading assembly according to any one of claims 11-15, wherein the preloading module is used for:
    通过预设解析框架分析所述页面源码,获取其中的静态资源依赖;Analyze the source code of the page through the preset analysis framework to obtain the static resource dependencies;
    根据所述静态资源依赖向所述资源请求模块发送所述第一静态资源请求。Sending the first static resource request to the resource request module according to the static resource dependency.
  17. 根据权利要求11-16中任一项所述的加载组件,其特征在于,所述预加载模块,用于:The loading assembly according to any one of claims 11-16, wherein the preloading module is used for:
    通过所述预设解析框架将需要注入的预设代码写入所述目标小程序页面对应的所述页面源码;Writing the preset code to be injected into the page source code corresponding to the target applet page through the preset parsing framework;
    所述预设代码包括:所述页面源码所需的静态资源的引用代码。The preset code includes: the reference code of the static resource required by the page source code.
  18. 根据权利要求11-17中任一项所述的加载组件,其特征在于,所述资源请求模块,用于:The loading component according to any one of claims 11-17, wherein the resource request module is configured to:
    当接收到所述第一静态资源请求时,根据所述第一静态资源请求在预置资源包中进行第一资源匹配;When receiving the first static resource request, perform first resource matching in the preset resource package according to the first static resource request;
    若所述第一资源匹配未成功,则在本地网络缓存中进行第二资源匹配;If the first resource matching is not successful, then perform second resource matching in the local network cache;
    若所述第二资源匹配未成功,则发送网络请求以更新所述本地网络缓存。If the second resource is not matched successfully, a network request is sent to update the local network cache.
  19. 根据权利要求11-18中任一项所述的加载组件,所述资源请求模块,用于:The loading component according to any one of claims 11-18, the resource request module is configured to:
    当接收到所述第二静态资源请求时,根据所述第二静态资源请求在所述预置资源包中进行第三资源匹配;When receiving the second static resource request, perform third resource matching in the preset resource package according to the second static resource request;
    若所述第三资源匹配成功,则将匹配到的静态资源返回所述容器模块;If the third resource is successfully matched, returning the matched static resource to the container module;
    若所述第三资源匹配未成功,则在本地网络缓存中进行第四资源匹配;If the matching of the third resource is not successful, performing fourth resource matching in the local network cache;
    若所述第四资源匹配成功,则将匹配到的静态资源返回所述容器模块;If the matching of the fourth resource is successful, returning the matched static resource to the container module;
    若所述第四资源匹配未成功,则发送网络请求以获取所述目标静态资源。If the matching of the fourth resource is unsuccessful, a network request is sent to obtain the target static resource.
  20. 根据权利要求11-19中任一项所述的加载组件,其特征在于,所述网络请求包括:The loading component according to any one of claims 11-19, wherein the network request includes:
    对资源管理平台配置的业务静态资源和/或外部静态资源的网络请求。Network requests for business static resources and/or external static resources configured on the resource management platform.
  21. 一种页面加载系统,其特征在于,包括:A page loading system, characterized in that it comprises:
    应用客户端,其包含如权利要求11-20中任一项所述的页面加载组件;An application client comprising the page loading component according to any one of claims 11-20;
    应用服务端,其包含资源管理平台,用于向所述应用客户端下发更新预置资源包和/或用于向所述应用客户端提供业务静态资源。The application server includes a resource management platform, configured to issue an update preset resource package to the application client and/or provide service static resources to the application client.
  22. 一种页面加载装置,其特征在于,包括:A page loading device, characterized in that it comprises:
    至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行:如权利要求1-10中任一项所述的方法。At least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform: The method of any one of claims 1-10.
  23. 一种计算机可读存储介质,所述计算机可读存储介质存储有程序,当所述程序被多核处理器执行时,使得所述多核处理器执行如权利要求1-10中任一项所述的方法。A computer-readable storage medium, the computer-readable storage medium stores a program, and when the program is executed by a multi-core processor, the multi-core processor executes the method described in any one of claims 1-10 method.
PCT/CN2022/074662 2021-08-23 2022-01-28 Page loading method, assembly, system, apparatus, and computer-readable storage medium WO2023024436A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110967875.9A CN113742623A (en) 2021-08-23 2021-08-23 Page loading method, assembly, system, device and computer readable storage medium
CN202110967875.9 2021-08-23

Publications (1)

Publication Number Publication Date
WO2023024436A1 true WO2023024436A1 (en) 2023-03-02

Family

ID=78732291

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/074662 WO2023024436A1 (en) 2021-08-23 2022-01-28 Page loading method, assembly, system, apparatus, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN113742623A (en)
WO (1) WO2023024436A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407091A (en) * 2023-12-12 2024-01-16 中核武汉核电运行技术股份有限公司 Rapid WEB picture loading method and system based on file localization deployment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742623A (en) * 2021-08-23 2021-12-03 中国银联股份有限公司 Page loading method, assembly, system, device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657170A (en) * 2013-11-25 2015-05-27 腾讯科技(上海)有限公司 Data updating method, device and system
CN110020278A (en) * 2017-09-08 2019-07-16 阿里巴巴集团控股有限公司 Displaying, providing method, client and the server of page data
CN111259283A (en) * 2018-11-30 2020-06-09 阿里巴巴集团控股有限公司 Page resource preloading processing method and device, electronic device and storage device
CN111310084A (en) * 2018-12-12 2020-06-19 北京嘀嘀无限科技发展有限公司 Page loading method, device and system, user terminal and readable storage medium
CN113742623A (en) * 2021-08-23 2021-12-03 中国银联股份有限公司 Page loading method, assembly, system, device and computer readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2824592A1 (en) * 2013-07-08 2015-01-14 OnApp Limited Content delivery network for adress modification of content items
US10009439B1 (en) * 2013-12-05 2018-06-26 Instart Logic, Inc. Cache preloading
CN106209925B (en) * 2015-04-29 2019-07-26 阿里巴巴集团控股有限公司 Page loading method, client and system
CN106933890B (en) * 2015-12-31 2021-08-06 北京冠群信息技术股份有限公司 Method and device for processing static page
CN109936605B (en) * 2017-12-18 2021-11-05 北京京东尚科信息技术有限公司 Method and device for loading interface data
CN108415963A (en) * 2018-02-07 2018-08-17 阿里巴巴集团控股有限公司 A kind of page generation method and device
CN109857960A (en) * 2019-01-14 2019-06-07 厦门美柚信息科技有限公司 A kind of method, equipment, system and its storage medium that page data updates
CN110287432A (en) * 2019-06-28 2019-09-27 北京金山安全软件有限公司 Network information processing method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657170A (en) * 2013-11-25 2015-05-27 腾讯科技(上海)有限公司 Data updating method, device and system
CN110020278A (en) * 2017-09-08 2019-07-16 阿里巴巴集团控股有限公司 Displaying, providing method, client and the server of page data
CN111259283A (en) * 2018-11-30 2020-06-09 阿里巴巴集团控股有限公司 Page resource preloading processing method and device, electronic device and storage device
CN111310084A (en) * 2018-12-12 2020-06-19 北京嘀嘀无限科技发展有限公司 Page loading method, device and system, user terminal and readable storage medium
CN113742623A (en) * 2021-08-23 2021-12-03 中国银联股份有限公司 Page loading method, assembly, system, device and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407091A (en) * 2023-12-12 2024-01-16 中核武汉核电运行技术股份有限公司 Rapid WEB picture loading method and system based on file localization deployment
CN117407091B (en) * 2023-12-12 2024-03-19 中核武汉核电运行技术股份有限公司 Rapid WEB picture loading method and system based on file localization deployment

Also Published As

Publication number Publication date
CN113742623A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
WO2023024436A1 (en) Page loading method, assembly, system, apparatus, and computer-readable storage medium
WO2018137564A1 (en) Service processing method and apparatus
US20090313319A1 (en) System and Method for Dynamic Partitioning of Applications in Client-Server Environments
CN111159614B (en) Webpage resource acquisition method and device
TWI671642B (en) Method for sharing data across applications and web browser
US8381098B2 (en) Webpage request handling
JP2014521184A (en) Activate trust level
US8973117B2 (en) Propagating security identity information to components of a composite application
CN109918191B (en) Method and device for preventing frequency of service request
US11301222B2 (en) Method for executing smart contract, blockchain node, and storage medium
JP2022550447A (en) A customized root process for a group of applications
US11637868B2 (en) Attestation support for elastic cloud computing environments
CN111598575A (en) Business process control method and device, electronic equipment and readable storage medium
US20220067721A1 (en) Method for executing smart contract, blockchain node, and storage medium
US20180097817A1 (en) Generating short-term signatures for accessing cloud storage
WO2020215833A1 (en) Offline cache method and apparatus, and terminal and readable storage medium
CN112667246A (en) Application function extension method and device and electronic equipment
US7668905B2 (en) Method, system and computer program for providing web pages based on client state
US10860297B2 (en) Methods for efficiently managing data analytics using complex dependency pipelines and devices thereof
US20220066756A1 (en) Method for executing smart contract, blockchain node, and storage medium
US20230229438A1 (en) Kernels as a service
US8280950B2 (en) Automatic client-server code generator
US9369467B1 (en) System, method, and computer program for providing generic access to web content on a mobile device
CN112910980B (en) Database access system and method
CN107870816B (en) Method and device for processing and storing image

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22859795

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE