Page resource pre-fetching method, device, medium and electronic device
By automatically determining and writing the resource address of the page to be deployed using preset development plug-ins before the page is published and deployed, the problem of difficulty in maintaining the page resource prefetching function in the existing technology is solved, and development efficiency and user experience are improved.
Patent Information
- Application Number
- CN202210615900.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-05-31
AI Technical Summary
In the prior art, the maintenance of the page resource prefetching function requires a lot of manpower, which affects the efficiency of page development. The frequency of html page updates is high, resulting in frequent replacement of resource content, increasing maintenance difficulty.
Before the page is released and deployed, the page information of the page to be deployed is automatically obtained, the target page and target resources that need to be prefetched are determined, and written to the target page, so that they automatically prefetch resources when loading.
No need for developers to manually maintain the page resource prefetching function, which improves development efficiency and improves page loading speed and experience when users visit.
Smart Images

Figure CN114896542B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of front-end technology, and in particular to a page resource pre-fetching method, device, medium and electronic device. Background Art
[0002] In the prior art, in order to optimize the user experience and reduce the loading time of page opening, resources that may be accessed by future users are often preloaded before the user opens the page and stored in the browser. When the user opens the next page of the current page, the resource can be directly read from the browser cache without waiting for the network request again. However, HTML pages are updated frequently and the resource content in the page may need to be frequently replaced. In order to maintain the function of pre-fetching page resources in advance, page developers need to pay more manpower, which greatly affects the efficiency of page development. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides a page resource prefetching method, the method comprising: before publishing and deploying a page, obtaining page information of a page to be deployed through the preset development plug-in, the page to be deployed being one or more; determining a target page for which resource prefetching is required based on the page information of the page to be deployed, the resource to be prefetched being a resource included in a next page corresponding to the target page; determining a target resource for which resource prefetching is required in a resource list included in the next page corresponding to the target page; determining a resource address of the target resource, and writing the resource address into the target page according to preset rules through the preset development plug-in before publishing and deploying the target page, so that the target page can automatically prefetch the target resource in the resource address when it is loaded.
[0005] In the second aspect, the present disclosure also provides a page resource prefetching device, which includes: an acquisition module, which is used to obtain page information of a to-be-deployed page through the preset development plug-in before the page is published and deployed, and the to-be-deployed page is one or more; a first determination module, which is used to determine a target page that needs to be prefetched for resources based on the page information of the to-be-deployed page, and the resources that need to be prefetched are the resources included in the next page corresponding to the target page; a second determination module, which is used to determine the target resources that need to be prefetched for the resources in the resource list included in the next page corresponding to the target page; an automatic writing module, which is used to determine the resource address of the target resource, and write the resource address into the target page according to preset rules through the preset development plug-in for publishing and deployment, so that the target page can automatically prefetch the target resource in the resource address when it is loaded.
[0006] In a third aspect, the present disclosure further provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when the program is executed by a processing device.
[0007] In a fourth aspect, the present disclosure further provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0008] Through the above technical solution, before the page is published and deployed, the resources that need to be pre-fetched in the next page corresponding to the page to be deployed can be automatically determined through the preset development plug-in, and these resources can be automatically written into the page to be deployed through the preset development plug-in, so that when the page to be deployed is loaded, the resources of the next page can be automatically pre-fetched. In this way, even if the HTML page resource content is frequently updated, there is no need for the developer to manually maintain the page resource pre-fetching function, which not only improves the developer's page development efficiency, but also improves the user's page experience at the same time.
[0009] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0011] Figure 1 The present invention is a flowchart of a method for pre-fetching page resources according to an exemplary embodiment of the disclosure.
[0012] Figure 2 The figure is a flowchart of a method for pre-fetching page resources according to another disclosed exemplary embodiment.
[0013] Figure 3 It is a flowchart of a specific method for prefetching page resources according to an exemplary embodiment of the present disclosure.
[0014] Figure 4 The present invention is a structural block diagram of a device for pre-fetching page resources according to an exemplary embodiment disclosed herein.
[0015] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0016] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0017] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0018] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0019] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0022] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0023] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0024] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0025] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0026] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0027] Figure 1 FIG. 1 is a flow chart of a method for prefetching page resources according to an exemplary embodiment disclosed in the disclosure. Figure 1 As shown, the method includes steps 101 to 104.
[0028] In step 101, before the page is published and deployed, the page information of the page to be deployed is obtained through the preset development plug-in, and the page to be deployed is one or more. The page to be deployed can be a page that needs to be updated according to the actual scenario. The specific update content is not limited in this disclosure. As long as it is a page to be published and deployed, it can be used as the page to be deployed in this disclosure. The page can be a web page opened in a browser or an application page in an application. The preset development plug-in can be any plug-in that can be used in the development process, such as a compilation plug-in used in the compilation process, or a related function plug-in used after the compilation is completed.
[0029] In step 102, a target page that needs to be pre-fetched is determined according to the page information of the page to be deployed, and the resources that need to be pre-fetched are the resources included in the next page corresponding to the target page.
[0030] In step 103, the target resource that needs to be pre-fetched is determined in the resource list included in the next page corresponding to the target page.
[0031] After obtaining the page information of the page to be deployed, it can be determined whether the page to be deployed is a page that needs to be pre-fetched according to the page information therein. If so, the target resources that need to be pre-fetched can be determined according to the methods of steps 102 and 103. If not, the page to be deployed can be skipped directly. When determining whether the page to be deployed is a page that needs to be pre-fetched, it can be determined based on the resource list included in the next page corresponding to the page to be deployed. For example, when there are resources that need to be pre-fetched in the next page corresponding to the page to be deployed, the page to be deployed can be determined as a target page that needs to be pre-fetched.
[0032] Among them, in the process of publishing and deploying a page, the pages to be deployed may include multiple pages such as the entry page and subsequent pages that may be opened by the entry page. When judging whether the page to be deployed is a page that needs to be pre-fetched, each page to be deployed can be judged in turn according to the opening order of the page to be deployed. After judging each page to be deployed, the page to be deployed that is determined to need to be pre-fetched can be determined as the target page. If all the pages to be deployed obtained in step 101 are not the target page that needs to be pre-fetched, the method of page resource pre-fetching in the present disclosure can be directly skipped, and the page to be deployed can be directly published and deployed.
[0033] After determining the target page that needs to be pre-fetched, the specific resources that need to be pre-fetched in the next page corresponding to the target page can be obtained as the target resource. There can be multiple methods for determining whether the resources in the resource list included in the next page corresponding to the target page are the target resources that need to be pre-fetched. For example, all resources in the resource list included in the next page corresponding to the target page can be directly determined as the target resources for pre-fetching, which can simplify the complexity of the page resource pre-fetching preparation work before the page is published and deployed, but to a certain extent, it may cause too much pre-fetched content when the user accesses the page, affecting the browser or client application response speed; or, the method for determining whether the resources in the resource list included in the next page corresponding to the target page are the target resources that need to be pre-fetched can also be to determine a preset number of resources in the resource list included in the next page corresponding to the target page as the target resources. In this way, by controlling the number of resources pre-fetched on the page, the pre-fetched content when the user accesses the page can be reduced, solving the problem of affecting the browser or client application response speed due to too much pre-fetched content.
[0034] In addition, in a possible implementation, when determining the target page that needs to be pre-fetched based on the page information of the page to be deployed, the page to be deployed can also be directly used as the target page, and when the target resource that needs to be pre-fetched is determined in the resource list included in the next page corresponding to the target page, a more detailed determination of the target resource is performed. In this way, the complexity of the pre-fetching preparation work of the page resources before the page is published and deployed can be simplified in the step of determining the target page, and the step of determining the target resources can ensure that the number of target resources or the resource content finally determined can meet the expected parameter requirements, thereby avoiding the problem of pre-fetching too much content when the user accesses the page, affecting the response speed of the browser or client application.
[0035] The operations of determining the target page and the target resources in the target page in the aforementioned steps 102 and 103 may be performed through other preset programs, or, may be the same as the operations in steps 101 and 104, and may be performed together with the preset development plug-in. This is not limited in the present application, as long as the operations of determining the target page and the target resources in the target page in steps 102 and 103 can be implemented.
[0036] In step 104, the resource address of the target resource is determined, and the resource address is written into the target page according to preset rules through the preset development plug-in and then published and deployed, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded.
[0037] After the above steps, after the target resource that needs to be pre-fetched for the page resource is determined, the resource address of the target resource can be determined, and the resource address of the target resource can be written into the target page according to the preset rules corresponding to at least one method commonly used currently, and then the target page is published and deployed. When the user accesses the target page, the browser or application can, for example, pre-fetch the resources in the next page according to the resource address of the target resource after loading the page body, so as to avoid affecting the opening speed of the target page itself.
[0038] The method for determining the resource address may be to determine the resource address url of the target resource according to the content delivery network CDN domain name and path corresponding to the target resource.
[0039] The preset rule may be, for example, a usage rule of the keyword prefetch, and the process of writing the resource address into the target page according to the preset rule may be to splice the resource address into corresponding code according to the usage rule of the keyword prefetch, and write the code into the target page. For example, a code example including the keyword prefetch may be as follows.
[0040] XML
[0041] <link rel="prefetch"href={目标资源的资源地址}>
[0042] In addition, the preset rule can also be any other preset rule that can realize pre-fetching of resources in the next page according to the resource address of the target resource. The specific rule content and the code content written into the target page are not limited in the present disclosure, as long as the target resource in the next page of the target page can be pre-fetched.
[0043] Through the above technical solution, before the page is published and deployed, the resources that need to be pre-fetched in the next page corresponding to the page to be deployed can be automatically determined through the preset development plug-in, and these resources can be automatically written into the page to be deployed through the preset development plug-in, so that when the page to be deployed is loaded, the resources of the next page can be automatically pre-fetched. In this way, even if the HTML page resource content is frequently updated, there is no need for the developer to manually maintain the page resource pre-fetching function, which not only improves the developer's page development efficiency, but also improves the user's page experience at the same time.
[0044] Figure 2 FIG. 1 is a flow chart of a method for prefetching page resources according to another exemplary embodiment of the present disclosure. Figure 2 As shown, the method further includes step 201 and step 202.
[0045] In step 201, a target page for which resource prefetching is required among the pages to be deployed is determined according to page information of the pages to be deployed and a first preset parameter configuration rule.
[0046] In step 202, the target resource that needs to be pre-fetched is determined in the resource list included in the next page corresponding to the target page according to the second preset parameter configuration rule.
[0047] The page information of the page to be deployed may include the jump relationship between all pages in the page to be deployed and the resource list included in all pages in the page to be deployed, so that the next page and the previous page of each page to be deployed can be known according to the page information of the page to be deployed. And the first preset parameter configuration rule may include the target resource file type that needs to be pre-fetched, then, determining the target page that needs to be pre-fetched in the page to be deployed according to the page information of the page to be deployed and the first preset parameter configuration rule may include: if the resource list included in the next page corresponding to the page to be deployed includes the resource of the target resource file type, then the page to be deployed is determined as the target page.
[0048] After filtering the resource types that need to be pre-fetched in the next page of the target page by the first preset parameter configuration rule, when determining the target resources that need to be pre-fetched in the resource list included in the next page corresponding to the target page according to the second preset parameter configuration rule, the resources that need to be pre-fetched in the next page of the target page can also be further filtered by the second preset parameter configuration rule. For example, the second preset parameter configuration rule may include the name of the target resource file that needs to be pre-fetched, then, determining the target resource that needs to be pre-fetched in the resource list included in the next page corresponding to the target page according to the second preset parameter configuration rule may include: if the resource list included in the next page corresponding to the target page includes a resource that matches the target resource file name, then the resource that matches the target resource file name is determined as the target resource.
[0049] The target resource file name and the resource name in the resource list included in the next page corresponding to the target page may not be completely the same due to compilation. For example, the target resource file name may be A.js, while the resource name corresponding to the target resource file name in the resource list included in the next page corresponding to the target page may be A_xx.js. Therefore, when determining the target resource that needs to be pre-fetched, the target resource file name and the resource in the resource list included in the next page corresponding to the target page can be matched according to certain matching rules to ensure the matching rate.
[0050] In addition, the first preset parameter configuration rule and the second preset parameter configuration rule may be the same rule or different rules.
[0051] For example, in different situations, the contents included in the first preset parameter configuration rule and the second preset parameter configuration rule may be as described above, and the first preset parameter configuration rule may only include the target resource file types that need to be pre-fetched, such as .js files, etc., so that when determining the target page that needs to be pre-fetched in the page to be deployed, the target page that needs to be pre-fetched in the page to be deployed can be determined through a coarser screening granularity. The second preset parameter configuration rule may specifically include the target resource file name that needs to be pre-fetched, so that the target resource that needs to be pre-fetched is determined accurately according to the target resource file name that needs to be pre-fetched, thereby ensuring the accuracy of resource pre-fetching.
[0052] In the case where the first preset parameter configuration rule and the second preset parameter configuration rule are the same rule, the first preset parameter configuration rule and the second preset parameter configuration rule may include both the target resource file type that needs to be pre-fetched and the target resource file name that needs to be pre-fetched. Figure 2 In step 201 and step 202 shown in , the target page and the target resource are determined by using part of the first preset parameter configuration rule or all of the rules in the second preset parameter configuration rule, which is permitted in the present disclosure, and the developer can configure and select parameters in real time according to the actual application scenario.
[0053] In a possible implementation, the obtaining of the page information of the page to be deployed through the preset development plug-in includes: obtaining the page information of the page to be deployed through the preset development plug-in according to the compilation product obtained by compiling the page to be deployed; or obtaining the page information of the page to be deployed through the preset development plug-in according to the compilation result obtained after the page to be deployed is successfully compiled. Among them, when obtaining the page information of the page to be deployed according to the compilation product, the method of prefetching page resources in the present disclosure can be implemented by the compilation function plug-in applied in the compilation process, and after the resource address that needs to be prefetched in the next page is written into the target page, the compilation product is output; when obtaining the page information of the page to be deployed according to the compilation result after the compilation is completed, it can be implemented by means of a compilation script, so as not to interfere with the compilation process.
[0054] According to the following Figure 3 The flowchart shown in FIG. 1 is used to describe in detail a specific page resource pre-fetching method according to an exemplary embodiment of the present disclosure. Figure 3 As shown, first obtain the compiled product obtained by compiling the page to be deployed, and all page information of the page to be deployed can be obtained through the compiled product, such as Figure 3 As shown in , each page obtained from the compiled product includes page information such as page name, page content, resource list, etc., and the opening relationship between each page is also included in each page information. After obtaining the page information of the page to be deployed, the target page for resource pre-fetching in the page to be deployed can be determined according to the first preset parameter configuration rule, such as Figure 3 As shown, each page is matched according to the first preset parameter configuration rule, so that the successfully matched page is determined as the target page that needs to be pre-fetched. The specific content of the first preset parameter configuration rule has been described in the previous text and will not be repeated here. After obtaining the target page, you can Figure 3 As shown, a resource list included in the next page of the target page is obtained, and the target resource that needs to be pre-fetched is further matched according to the second preset parameter configuration rule. Finally, in order to achieve the purpose of pre-fetching the resources required in the next page of the target page when the user opens the target page, the target resource needs to be written into the target page. The specific writing method can be based on Figure 3 As shown in , the resource address of the target resource is first determined, and then the content to be written into the target page is generated according to the preset rule, and finally written into the target page. Thus, according to the conventional page deployment process, after the processed compilation product is output, each to-be-deployed page is published and deployed, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded.
[0055] Figure 4 FIG. 1 is a structural block diagram of a page resource pre-fetching device according to an exemplary embodiment of the present disclosure. Figure 4 As shown, the device includes: an acquisition module 10, which is used to obtain page information of a to-be-deployed page through a preset development plug-in before publishing and deploying the page, and the to-be-deployed page is one or more; a first determination module 20, which is used to determine a target page that needs to pre-fetch resources according to the page information of the to-be-deployed page, and the resources that need to be pre-fetched are the resources included in the next page corresponding to the target page; a second determination module 30, which is used to determine the target resource that needs to be pre-fetched in the resource list included in the next page corresponding to the target page; an automatic writing module 40, which is used to determine the resource address of the target resource, and write the resource address into the target page according to the preset rules through the preset development plug-in and then publish and deploy, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded.
[0056] Through the above technical solution, before the page is published and deployed, the resources that need to be pre-fetched in the next page corresponding to the page to be deployed can be automatically determined through the preset development plug-in, and these resources can be automatically written into the page to be deployed through the preset development plug-in, so that when the page to be deployed is loaded, the resources of the next page can be automatically pre-fetched. In this way, even if the HTML page resource content is frequently updated, there is no need for the developer to manually maintain the page resource pre-fetching function, which not only improves the developer's page development efficiency, but also improves the user's page experience at the same time.
[0057] In a possible implementation manner, the first determination module 20 is further configured to determine a target page for which resource prefetching is required among the pages to be deployed according to page information of the pages to be deployed and a first preset parameter configuration rule.
[0058] In a possible implementation manner, the second determination module 30 is further configured to determine, in accordance with a second preset parameter configuration rule, a target resource for which resource pre-fetching is required in a resource list included in a next page corresponding to the target page.
[0059] In a possible implementation, the page information of the page to be deployed includes the jump relationship between all pages in the page to be deployed and the resource list included in all pages in the page to be deployed, and the first preset parameter configuration rule includes the target resource file type that needs to be pre-fetched, wherein the first determination module 20 is also used to: if the resource list included in the next page corresponding to the page to be deployed includes resources of the target resource file type, then the page to be deployed is determined as the target page.
[0060] In a possible implementation, the second preset parameter configuration rule includes the name of a target resource file that needs to be pre-fetched, wherein the second determination module 30 is further used to: if the resource list included in the next page corresponding to the target page includes a resource that matches the target resource file name, then the resource that matches the target resource file name is determined as the target resource.
[0061] In a possible implementation manner, the automatic writing module 40 is further configured to determine a resource address of the target resource according to a content delivery network CDN domain name and path corresponding to the target resource.
[0062] In a possible implementation manner, the automatic writing module 40 is further configured to: splice the resource addresses into corresponding codes according to a preset rule, and write the codes into the target page.
[0063] In a possible implementation, the acquisition module 10 is also used to: obtain the page information of the page to be deployed through the preset development plug-in according to the compilation product obtained by compiling the page to be deployed; or obtain the page information of the page to be deployed through the preset development plug-in according to the compilation result obtained after the page to be deployed is successfully compiled.
[0064] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0065] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0066] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0067] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0068] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0069] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0070] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0071] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains page information of the page to be deployed before publishing and deploying the page; determines the target page that needs to be pre-fetched according to the page information of the page to be deployed; determines the target resource that needs to be pre-fetched in the resource list included in the next page corresponding to the target page; determines the resource address of the target resource, and writes the resource address to the target page according to a preset rule and then publishes and deploys it, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded. .
[0072] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0073] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0074] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of the module does not limit the module itself in some cases. For example, the acquisition module 10 may also be described as "a module for acquiring page information of a page to be deployed before publishing and deploying the page".
[0075] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0076] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0077] According to one or more embodiments of the present disclosure, Example 1 provides a page resource prefetching method, including: before publishing and deploying a page, obtaining page information of a page to be deployed through a preset development plug-in, wherein the page to be deployed is one or more; determining a target page that needs to be prefetched for resources based on the page information of the page to be deployed, wherein the resources that need to be prefetched are resources included in the next page corresponding to the target page; determining the target resource that needs to be prefetched for the resource in the resource list included in the next page corresponding to the target page; determining a resource address of the target resource, and writing the resource address into the target page according to preset rules through the preset development plug-in before publishing and deploying the target page, so that the target page can automatically prefetch the target resource in the resource address when it is loaded.
[0078] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein determining the target page requiring resource prefetching based on the page information of the page to be deployed includes: determining the target page requiring resource prefetching in the page to be deployed based on the page information of the page to be deployed and a first preset parameter configuration rule.
[0079] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein determining the target resources that need to be pre-fetched in the resource list included in the next page corresponding to the target page includes: determining the target resources that need to be pre-fetched in the resource list included in the next page corresponding to the target page according to a second preset parameter configuration rule.
[0080] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2, wherein the page information of the page to be deployed includes the jump relationship between all pages in the page to be deployed and the resource list included in all pages in the page to be deployed, and the first preset parameter configuration rule includes the target resource file type that needs to be pre-fetched. wherein, determining the target page that needs to be pre-fetched in the page to be deployed based on the page information of the page to be deployed and the first preset parameter configuration rule includes: if the resource list included in the next page corresponding to the page to be deployed includes resources of the target resource file type, then the page to be deployed is determined as the target page.
[0081] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 3, wherein the second preset parameter configuration rule includes a target resource file name that needs to be pre-fetched, wherein:
[0082] The method of determining the target resource that needs to be pre-fetched in the resource list included in the next page corresponding to the target page according to the second preset parameter configuration rule includes: if the resource list included in the next page corresponding to the target page includes a resource that matches the target resource file name, then the resource that matches the target resource file name is determined as the target resource.
[0083] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, wherein determining the resource address of the target resource includes: determining the resource address of the target resource according to a content delivery network CDN domain name and path corresponding to the target resource.
[0084] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, wherein writing the resource address into the target page according to preset rules comprises: splicing the resource address into corresponding codes according to preset rules, and writing the codes into the target page.
[0085] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 1, wherein obtaining the page information of the page to be deployed through a preset development plug-in includes: obtaining the page information of the page to be deployed through the preset development plug-in according to a compilation product obtained by compiling the page to be deployed; or obtaining the page information of the page to be deployed through the preset development plug-in according to a compilation result obtained after the page to be deployed is successfully compiled.
[0086] According to one or more embodiments of the present disclosure, Example 9 provides a page resource prefetching device, including: an acquisition module, used to obtain page information of a to-be-deployed page through a preset development plug-in before the page is published and deployed, and the to-be-deployed page is one or more; a first determination module, used to determine a target page that needs to be prefetched for resources based on the page information of the to-be-deployed page, and the resources that need to be prefetched are the resources included in the next page corresponding to the target page; a second determination module, used to determine the target resource that needs to be prefetched for the resource in the resource list included in the next page corresponding to the target page; an automatic writing module, used to determine the resource address of the target resource, and write the resource address into the target page according to preset rules through the preset development plug-in and then publish and deploy it, so that the target page can automatically prefetch the target resource in the resource address when it is loaded.
[0087] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable medium having a computer program stored thereon, characterized in that when the program is executed by a processing device, the steps of the method described in any one of Examples 1-8 are implemented.
[0088] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-8.
[0089] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0090] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0091] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A page resource pre-fetching method, characterized in that: The method comprises: Before publishing and deploying a page, obtain page information of a page to be deployed through a preset development plug-in, where the page to be deployed is one or more; Determine the target page for which resource prefetching is required according to the page information of the page to be deployed and the target resource file type for which resource prefetching is required, wherein the resource to be prefetched is the resource included in the next page corresponding to the target page; According to the target resource file name for resource pre-fetching as needed, determining the target resource for which the resource pre-fetching needs to be performed in the resource list included in the next page corresponding to the target page; The resource address of the target resource is determined, and the resource address is written into the target page according to preset rules through the preset development plug-in and then released and deployed, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded.
2. The method according to claim 1, characterized in that The page information of the page to be deployed includes the jump relationship between all pages in the page to be deployed and the resource list included in all pages in the page to be deployed; The method of determining the target page requiring resource prefetching based on the page information of the page to be deployed and the target resource file type requiring resource prefetching includes: if the resource list included in the next page corresponding to the page to be deployed includes resources of the target resource file type, then determining the page to be deployed as the target page.
3. The method according to claim 2, characterized in that The target resource file name for prefetching resources as needed, determining the target resource that needs to be prefetched in the resource list included in the next page corresponding to the target page includes: if the resource list included in the next page corresponding to the target page includes resources that match the target resource file name, then the resource that matches the target resource file name is determined as the target resource.
4. The method according to claim 1, characterized in that: Determining the resource address of the target resource includes: Determine the resource address of the target resource according to the content delivery network CDN domain name and path corresponding to the target resource.
5. The method according to claim 1, characterized in that Writing the resource address into the target page according to a preset rule comprises: The resource addresses are spliced into corresponding codes according to preset rules and written into the target page.
6. The method according to claim 1, characterized in that The step of obtaining the page information of the page to be deployed by using the preset development plug-in includes: Obtaining page information of the page to be deployed through the preset development plug-in according to a compilation product obtained by compiling the page to be deployed; or The page information of the page to be deployed is obtained through the preset development plug-in according to the compilation result obtained after the page to be deployed is successfully compiled.
7. A page resource pre-fetching device, characterized in that: The device comprises: An acquisition module is used to acquire page information of a page to be deployed through a preset development plug-in before publishing and deploying the page, where the page to be deployed may be one or more pages; A first determination module is used to determine a target page for which resource prefetching is required according to the page information of the page to be deployed and the target resource file type for which resource prefetching is required, wherein the resource to be prefetched is a resource included in a next page corresponding to the target page; A second determination module is used to determine the target resource that needs to be pre-fetched according to the target resource file name that needs to be pre-fetched in the resource list included in the next page corresponding to the target page; The automatic writing module is used to determine the resource address of the target resource, and write the resource address into the target page according to the preset rules through the preset development plug-in and then publish and deploy it, so that the target page can automatically pre-fetch the target resource in the resource address when it is loaded.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 6 are implemented.
9. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Page loading method and device, storage medium and electronic equipment
CN112579938A
Page loading method and device, electronic equipment and readable storage medium
CN114510284A