CN117331625A - Page resource loading method and device, computer equipment and storage medium - Google Patents

Page resource loading method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN117331625A
CN117331625A CN202311409801.9A CN202311409801A CN117331625A CN 117331625 A CN117331625 A CN 117331625A CN 202311409801 A CN202311409801 A CN 202311409801A CN 117331625 A CN117331625 A CN 117331625A
Authority
CN
China
Prior art keywords
resource
client
page
address
public
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311409801.9A
Other languages
Chinese (zh)
Inventor
王慧杰
罗涛
赵海强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202311409801.9A priority Critical patent/CN117331625A/en
Publication of CN117331625A publication Critical patent/CN117331625A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • 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/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application relates to a loading method and device of page resources, computer equipment and a storage medium. The method applied to the client comprises the following steps: monitoring the use condition of a client to a processor; under the condition that the use rate of the processor is lower than a set threshold value, sending a webpage address request to a server to acquire the webpage address of an index webpage of the public resource; the server stores an index web page containing the resource address of each public resource; accessing an index webpage based on the webpage address, and loading public resources corresponding to the resource address in the index webpage into a local memory cache; responding to a loading request of the H5 page resource, acquiring the public resource from the memory cache under the condition that the requested H5 page resource comprises the public resource, and displaying the corresponding H5 page based on the public resource; the common resources in the memory cache can be dynamically updated in time, and the H5 page can be displayed by hitting the memory cache when the H5 page is loaded, so that the loading speed of the page is improved.

Description

Page resource loading method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for loading a page resource.
Background
Compared with the original H5 technical stack, the H5 technical stack has the advantages of poor loading performance, high development efficiency, cross-platform performance and the like. In order to improve the loading speed of the H5 page, the optimization means commonly used in the industry at present include an H5 offline package mechanism, web side rendering optimization, JS logic optimization and the like. When loading a page, a client using an H5 offline package mechanism still obtains the page from an offline package even if a memory cache or a disk cache is hit, so that the method is more suitable for a page loading scene with frequent change and cache failure; for the pages with infrequent changes, the loading speed of the offline package is lower than that of the cache, and if an H5 offline package mechanism is also used, negative influence is caused on the loading of the H5 pages. Therefore, for the pages with infrequent modification, it is desirable to provide a method capable of improving the loading speed of the H5 page.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a loading method, apparatus, computer device, computer readable storage medium, and computer program product for a page resource that can increase the H5 page loading speed for pages that are not frequently changed.
In a first aspect, the present application provides a method for loading a page resource, applied to a client, where the method includes:
monitoring the use condition of the client to a processor;
sending a web page address request to a server under the condition that the use ratio of the client to the processor is lower than a set threshold value, so as to acquire the web page address of an index web page of a public resource; wherein the server stores the index web pages containing resource addresses of the public resources;
accessing the index webpage based on the webpage address, and loading the public resource corresponding to the resource address contained in the index webpage into a local memory cache;
and responding to a loading request of the H5 page resource, acquiring the public resource from the memory cache under the condition that the requested H5 page resource comprises the public resource, and displaying the corresponding H5 page based on the public resource.
In one embodiment, the accessing the index web page based on the web page address includes:
and accessing the index webpage based on the webpage address through the hidden client container instance created by the client.
In one embodiment, the common resources include function files, table files, and/or graphic files;
the loading the public resource corresponding to the resource address contained in the index web page into a local memory cache includes:
and loading the function file, the table file and/or the image file corresponding to the resource address contained in the index webpage into a local memory cache.
In one embodiment, the sending, to a server, a web address request if it is detected that the usage rate of the processor by the client is lower than a set threshold value includes:
and sending a webpage address request to a server under the condition that the main thread of the client is monitored and the utilization rate of the processor is lower than a set threshold value in a preset time period.
In one embodiment, the sending, to a server, a web address request if it is detected that the usage rate of the processor by the client is lower than a set threshold value includes:
and sending a webpage address request to a server under the condition that the main thread of the client is detected to be in a dormant state.
In one embodiment, the monitoring the usage of the processor by the client includes:
And under the condition that the client is in a home page display state, monitoring the use condition of the client for the processor.
In one embodiment, the method further comprises:
in the case that the requested H5 page resource includes a network resource, initiating a request for the network resource to the server; wherein the network resource does not belong to the common resource.
In a second aspect, the present application further provides a method for loading a page resource, which is applied to a server, and the method includes:
acquiring a resource address of a public resource, and generating a public resource index webpage based on the resource address; wherein the index web page contains the resource address of each public resource;
responding to a webpage address request of a client for the index webpage, and returning the webpage address of the index webpage to the client.
In one embodiment, the generating the common resource index web page based on the resource address includes:
and under the condition that the public resources in the public resource library are updated, updating the index web page based on the updated resource address of the public resources.
In a third aspect, the present application further provides a loading device of a page resource, applied to a client, including:
The data monitoring module is used for monitoring the use condition of the client to the processor;
the resource request module is used for sending a webpage address request to a server under the condition that the use ratio of the client to the processor is lower than a set threshold value, so as to acquire the webpage address of an index webpage of the public resource; wherein the server stores the index web pages containing resource addresses of the public resources;
the resource pre-storing module is used for accessing the index web page based on the web page address, and loading the public resource corresponding to the resource address contained in the index web page into a local memory cache;
the resource loading module is used for responding to a loading request of the H5 page resource, acquiring the public resource from the memory cache under the condition that the requested H5 page resource comprises the public resource, and displaying the corresponding H5 page based on the public resource.
In a fourth aspect, the present application further provides a loading device of a page resource, which is applied to a server, and includes:
the resource acquisition module is used for acquiring the resource address of the public resource and generating a public resource index webpage based on the resource address; wherein the index web page contains the resource address of each public resource;
And the resource sending module is used for responding to a webpage address request of the client for the index webpage and returning the webpage address of the index webpage to the client.
In a fifth aspect, the present application further provides a computer device, comprising a memory and a processor, the memory storing a computer program, the processor implementing the method for loading page resources according to any one of the first or second aspects when the computer program is executed.
In a sixth aspect, the present application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of loading a page resource as in any of the first or second aspects.
In a seventh aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, implements a method of loading a page resource as claimed in any one of the first or second aspects.
When the method is applied to a client, when the utilization rate of the client to a processor is lower than a set threshold, acquiring a webpage address of an index webpage of a public resource from a server so as to load the public resource corresponding to the resource address contained in the index webpage into a local memory cache through the webpage address; the method realizes dynamic update acquisition of the webpage address, and pre-loads the public resource to the local memory cache, and the update acquisition process of the public resource does not influence the busy state of the client, and thus the normal use of the client by a user is not influenced; and when the loading requirement of the H5 page resource of the client comprises the public resource, the corresponding public resource is directly returned to the H5 page from the memory cache, so that page display is realized, and because the public resource in the memory cache can be dynamically preloaded, when the H5 page is loaded, the H5 page can be updated and displayed by hitting the memory cache, and the required resource is not required to be extracted through a server when the page is loaded, thereby improving the loading speed of the page and improving the use experience of a user.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is an application environment diagram of a method of loading page resources in one embodiment;
FIG. 2 is a flow diagram of a method for loading page resources in one embodiment;
FIG. 3 is a flowchart illustrating a method for loading page resources in another embodiment;
FIG. 4 is a flowchart of a method for loading page resources according to another embodiment;
FIG. 5 is a flow chart of a method of loading page resources in yet another embodiment;
FIG. 6 is a schematic flow chart of a loading method of page resources applied to a bank client in one embodiment;
FIG. 7 is a block diagram of a page resource loader in one embodiment;
FIG. 8 is a block diagram of a page resource loader in another embodiment;
FIG. 9 is an internal block diagram of a computer device in one embodiment;
Fig. 10 is an internal structural view of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The loading method of the page resource provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 12 communicates bi-directionally with the server 14 via a network. The data storage system may store data that the server 14 needs to process. The data storage system may be integrated on the server 14 or may be located on a cloud or other network server. The data stored in the data storage system may include a variety of resources required for page presentation, such as graph files, table files, function files, and the like. The terminal 12 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, and the internet of things devices may be smart televisions, smart car devices, and the like. The portable wearable device may be a smart watch, smart bracelet, or the like. The server 14 may be implemented as a stand-alone server or as a cluster of servers.
In an exemplary embodiment, as shown in fig. 2, a method for loading a page resource is provided, and the method is applied to the terminal 12 in fig. 1, where the terminal 12 includes a client, and the method includes the following steps 101 to 104, where:
step 101, monitoring the use condition of the client to the processor.
Specifically, the step 101 is executed to monitor the usage condition of the client to the processor (CPU, central Processing Unit) of the terminal, so as to determine the usage condition of the client to the processor in a certain period of time, thereby avoiding increasing the task processing requirement of the client under the condition that the client is in a busy period, avoiding the condition of resource preemption, thereby being beneficial to ensuring the processing efficiency of the task being processed in the client and ensuring the use experience of the user to the client.
Step 102, sending a web page address request to a server to acquire a web page address of an index web page of a public resource under the condition that the use ratio of a client to a processor is monitored to be lower than a set threshold; wherein the server stores an index web page containing resource addresses of the common resources.
Specifically, when the use condition of the client for the processor is monitored through step 101, step 102 may be further executed, and when the use ratio of the client for the processor is monitored to be lower than the set threshold, it is indicated that there is almost no interaction between the client and the user, where the task processing requirement in the client is relatively low, the processor of the client has enough capability to process other tasks temporarily added by the client, and at this time, the client may send the task to be processed to the processor for execution; the task sent by the client is to send a web page address request to the server to request the web page address of the index web page storing the resource address list of the public resource; according to the method and the device, the task of acquiring the webpage address is sent to the processor when the utilization rate of the client to the processor is lower than the set threshold, namely, when the processor of the client is idle, the webpage address can be acquired quickly, the execution efficiency of other tasks in the client cannot be influenced, normal execution of each task in the client is guaranteed, and the use experience of a user to the client is guaranteed.
It should be added that the step 102 of sending a web address request to a server to obtain a web address of an index web page of a public resource is a step that is performed each time it is monitored that the usage rate of the client to the processor is lower than a set threshold, and is not a one-time execution step; by executing the request task for the web page address in the server under the condition that the use ratio of the client to the processor is monitored to be low, the obtained web page address can be updated continuously, so that the updated web page address can be updated to the client in the shortest time as possible, and synchronous update of the web page address in the client can be realized efficiently.
It should be added that the specific value of the set threshold is not limited, the size of the set threshold can be set according to the requirement, for example, the size of the set threshold can be determined according to historical statistical data in the client, so long as the processor of the client can have enough utilization rate to process the request task of the client to the web page address in the server.
Step 103, accessing the index web page based on the web page address, and loading the public resource corresponding to the resource address contained in the index web page to the local memory cache.
Specifically, after the client obtains the web page address of the index web page by executing step 102, step 103 may be further executed, so that the client can access the index web page stored in the server based on the web page address, thereby loading the corresponding public resource to the local memory cache of the client through each resource address included in the index web page, so that the public resource can be saved to the client in advance, which is beneficial to facilitating the call of the public resource during the subsequent web page display, and improving the call speed of the public resource during the web page display.
Because step 102 dynamically updates the web page address requested to the client based on the utilization rate of the processor of the client, the public resources preloaded in step 103 are also dynamically and efficiently updated, which is beneficial to improving the update efficiency of the public resources stored in the local memory cache, does not affect the processing rate of other tasks in the client, and is beneficial to improving the use experience of the user.
Step 104, responding to the loading request of the H5 page resource, and under the condition that the requested H5 page resource comprises the public resource, acquiring the public resource from the memory cache, and displaying the corresponding H5 page based on the public resource.
Specifically, after the step 103 is executed to store the common resources in the local cache of the client, when there is an H5 page in the client to be displayed, the step 104 can be executed to respond to the loading request of the H5 page resources, and under the condition that the requested H5 page resources include the common resources, the required common resources can be directly obtained from the memory cache storing the common resources, and the display of the corresponding H5 page is realized based on the obtained common resources, so that the need of going to obtain the corresponding resources through the server is avoided, the loading speed of the H5 page is improved, and meanwhile, the use experience of the user to the client is also improved.
In the method for loading the page resources, when the method is applied to the client, when the utilization rate of the client to the processor is lower than a set threshold, the web page address of the index web page of the public resource is acquired from the server, so that the public resource corresponding to the resource address contained in the index web page is loaded to the local memory cache through the web page address; the method realizes dynamic update acquisition of the webpage address, and pre-loads the public resource to the local memory cache, and the update acquisition process of the public resource does not influence the busy state of the client, and thus the normal use of the client by a user is not influenced; and when the loading requirement of the H5 page resource of the client comprises the public resource, the corresponding public resource is directly returned to the H5 page from the memory cache, so that page display is realized, and because the public resource in the memory cache can be dynamically preloaded, when the H5 page is loaded, the H5 page can be updated and displayed by hitting the memory cache, and the required resource is not required to be extracted through a server when the page is loaded, thereby improving the loading speed of the page and improving the use experience of a user.
FIG. 3 is a flow chart of a method for loading page resources in another embodiment, in an exemplary embodiment, as shown in FIG. 3, accessing an index web page based on a web page address, comprising:
step 1031, accessing the index web page based on the web page address by the hidden client container instance created by the client.
Specifically, the step of accessing the index web page based on the web page address performed in the step 103 may be specifically performed through the step 1031, and the hidden client webview container instance created in the client in advance may be performed through the client container instance, so as to achieve access to the index web page based on the web page address. The hidden client container instance which cannot be perceived by the user is created in the client, so that the client container instance can be prevented from being seen by the user when the user uses the client container instance, and the client container instance which is not displayed to the user is beneficial to beautifying the page display effect of the client used by the user, thereby being beneficial to improving the user experience.
In one exemplary embodiment, as shown in FIG. 3, the common resources include function files, table files, and/or graphic files;
Loading the public resource corresponding to the resource address contained in the index webpage into the local memory cache, wherein the loading comprises the following steps:
in step 1032, the function file, table file and/or image file corresponding to the resource address included in the index web page is loaded into the local memory cache.
Specifically, the step of loading the public resources corresponding to the resource addresses included in the index web page and the local memory cache in the step 103 may be executed through step 1032, so as to load at least one of the function files, the table files and the map files corresponding to the resource addresses included in the index web page into the local memory cache of the client, so that various types of public resources can be pre-saved to the client, which is beneficial to facilitating the call of the public resources in the subsequent web page display, improving the call speed of the web page display to the public resources, and simultaneously enabling the displayed web page to have various elements, and guaranteeing the display effect of the web page.
In an exemplary embodiment, as shown in fig. 3, in a case that the usage rate of the processor by the client is monitored to be lower than the set threshold, sending a web address request to the server includes:
Step 1021, when the main thread of the client is monitored, and the usage rate of the processor is lower than the set threshold value in the preset time period, sending a web page address request to the server.
Specifically, the application further provides an optional implementation manner, in the step 102 of sending a web address request to the server when the usage rate of the processor by the client is monitored to be lower than the set threshold, specifically, the usage rate of the processor by the main thread of the client may be monitored by executing step 1021, and when the average usage rate of the processor by the main thread of the client is monitored to be lower than the set threshold in a preset period of time, the web address request is sent to the server. Because the thread interacted with the UI (User Interface) in the client is the main thread, in the time period with lower utilization rate of the main thread, the User almost does not operate the client, so that the web address request is sent to the server in the time period, and the web address request is not overlapped with the time period when the User is operating the client, the use effect of the client is not influenced, and the use experience of the User on the client is ensured.
It should be noted that, the duration of the preset time period is not specifically limited, and the specific duration of the preset time period may be selected according to the requirement, for example, the preset time period may be selected to be 200 ms, 600 ms, 1 second, 30 seconds, 1 minute, 6 minutes, 15 minutes, or several hours, etc.
In an exemplary embodiment, as shown in fig. 3, in a case that the usage rate of the processor by the client is monitored to be lower than the set threshold, sending a web address request to the server includes:
step 1022, in the case that the main thread of the client is monitored to be in the sleep state, sends a web page address request to the server.
Specifically, the application further provides an optional implementation manner, where the step of "sending the web address request to the server when the usage rate of the processor by the client is monitored to be lower than the set threshold" performed in the step 102 is performed, specifically, the step 1022 may be performed to monitor the usage rate of the processor by the main thread of the client, and send the web address request to the server when the main thread of the client is monitored to be in a dormant state, that is, the main thread is not occupied by the processor. Because the thread interacted with the UI (User Interface) in the client is the main thread, when the main thread is in a dormant state, the User is not operated on the client, so that the webpage address request is sent to the server in the time period and is not overlapped with the time period when the User is operating the client, the operation condition of the client is not influenced, and the use experience of the User on the client is ensured.
In an exemplary embodiment, as shown in fig. 3, monitoring the usage of a processor by a client includes:
in step 1011, the usage of the processor by the client is monitored under the condition that the client is in the home page display state.
Specifically, in an alternative embodiment, the monitoring of the usage of the processor by the client in step 101 may be implemented by executing step 1011, where the specific implementation content is to monitor the usage of the processor by the client after the client enters the home page and the home page is displayed immediately after the client is started. After the client enters the home page display state, the use condition of the processor by the client is monitored, and the webpage address of the resource address stored in the server can be updated at idle time in time, so that the client page displayed by the client at the follow-up time is the latest page after the resource is updated, and the use experience of the user to the client is improved.
In an exemplary embodiment, as shown in fig. 3, further includes:
step 105, in the case that the requested H5 page resource includes a network resource, initiating a request for the network resource to the server; wherein the network resources do not belong to a common resource.
Specifically, the application further provides an alternative embodiment, that is, after step 103 is executed, the loading method of the page resource applied to the client may further include the case shown in step 105, in addition to the case shown in step 104, that is, in response to the loading request of the H5 page, there may be a case that the requested H5 page includes a resource that does not belong to the common resource, in addition to the case that the requested H5 page includes the common resource; under the condition that the requested H5 page resources comprise network resources, the network resources are not in the local memory cache, at the moment, the request of the network resources can be initiated to the server, the server searches the required network resources and provides the network resources for the client to use, so that the display of the H5 page is realized through the public resources and the network resources together, and diversified page effects are provided for users.
The method includes the steps that after a client is started, a web page address of a public resource web page is requested to a server at an idle time, wherein the idle time is when a first page of the client is entered, the first page is displayed, a main thread is monitored to enter a dormant state, or the time when the average CPU utilization of the main thread is monitored to be lower than a certain threshold value within a period of time.
A hidden client webview container instance created in the background in the client loads public resources into a client memory cache by accessing a public resource webpage on a server.
When the client-side actual H5 page is entered, if the public resource is accessed in the page loading process, the memory cache is directly returned, and if the public resource is not accessed, the network request is initiated.
In summary, for the pages with infrequent changes, by loading the common resources in advance, when the actual pages are entered, the memory cache of the resources is hit, so that the effect of improving the page loading speed is achieved, and the method can be used in combination with the existing H5 loading optimization means, so that the user experience is improved to the greatest extent in multiple aspects.
Fig. 4 is a flowchart of a loading method of a page resource in yet another embodiment, in an exemplary embodiment, as shown in fig. 4, a loading method of a page resource is provided, and the method is applied to the server 14 in fig. 1 for illustration, and includes the following steps 201 to 202, where:
step 201, obtaining a resource address of a public resource, and generating a public resource index webpage based on the resource address; wherein, the index web page contains the resource address of each public resource.
Specifically, the step 201 is executed to first obtain the resource address of the public resource, and then generate a public resource index web page based on the obtained plurality of resource addresses, that is, the index web page contains the resource address of each public resource; it should be added that the public resources can be stored in a public picture library and a public JS/CSS file library, wherein the public picture library can be maintained and managed by a designer, and the public JS/CSS file library can be maintained and managed by a front-end engineer, so that the designer and the front-end engineer can realize the operations of adding, deleting and updating files in the public picture library and the public JS/CSS file library.
Step 202, responding to the web page address request of the client for indexing web pages, and returning the web page address of the indexing web pages to the client.
Specifically, after the generation of the index web page of the public resource in the server in step 201, when receiving the request of the client for the web address of the index web page, the server may respond to the request of the client for the web address of the index web page in step 202, so as to feed back the web address of the index web page stored in the server to the client, so that the client can access the index web page through the web address, and the client can conveniently obtain the corresponding public resource through the resource address in the index web page.
FIG. 5 is a flow chart of a method of loading page resources in yet another embodiment, in an exemplary embodiment, as shown in FIG. 5, generating a common resource index web page based on a resource address, comprising:
in step 2011, under the condition that the update of the public resources in the public resource library is monitored, updating the index web page based on the updated resource address of the public resources.
Specifically, the step of generating the public resource index web page based on the resource address in the step 201 may be implemented by step 2011, monitoring the public resource library, and updating the index web page based on the resource address of the updated public resource when it is monitored that the public resource in the public resource library is updated, for example, when the resource is added, deleted, or updated, so that the public resource of the memory cache is extracted by the subsequent client through the web page address to be the updated public resource, thereby facilitating the page element of the H5 page displayed to the user to be the updated version, and improving the use experience of the user to the client.
It should be noted that, under the condition that the update of the public resource in the public resource library is monitored, the process of updating the index web page based on the resource address of the updated public resource is dynamic, and the corresponding index web page is updated only if the update of the public resource in the public resource library is monitored, so as to ensure that the resource address contained in the index web page corresponds to the latest updated public resource.
Fig. 6 is a flow chart of an application of a method for loading a page resource to a bank client in an embodiment, referring to fig. 6, a specific embodiment is provided herein, in which a client to which the loading of the page resource provided in the present application is applied may be a client related to a bank service, a server (server) may be a corresponding bank server, a corresponding displayed H5 page is a transaction page in the bank service, and all required public resources are pictures or files related to the transaction page in the bank client, but this is only an alternative implementation provided in the present application, and application scenarios of the client and the server are not limited specifically.
By maintaining an index page in the server that points to each public resource, i.e. the index page is stored in the server, the index page supports automatic acquisition of the latest public resource list. The method comprises the following specific steps: and starting monitoring on the public picture library and the public JS/CSS file library, and automatically reading all files in the public picture library and the public JS/CSS file library and generating html files according to a certain rule when the operations of adding, deleting and updating the files in the public picture library and the public JS/CSS file library are monitored, wherein the selectable rule is that a script label is used for the JS files, a link label is used for the CSS files, and an img label is used for picture resources, wherein the html files are index web pages pointing to the files of each public resource. The JS file is a functional file, the CSS file is a table file, the script tag is a script element tag, the link tag is an external resource link element tag, and the img tag is an image embedded element tag.
In addition, an access interface may be provided in the server, for returning the generated request address of the index web page pointing to each public resource file, that is, the web page address; and supports dynamic updating of the common resource list.
The client requests the resource webpage address from the server in advance, the public resources are preloaded into the memory cache from the resource address contained in the index webpage through the webpage address, and when a user actually uses a transaction page of the client, namely enters an actual transaction (such as transfer), the user can directly hit the public resources stored in the cache, so that the display efficiency of the webpage is improved.
It is also necessary to supplement that, during the development period of the client, when the front-end engineer develops the actual H5 page, the front-end engineer preferentially introduces the required resources and front-end files from the public picture library and the public JS/CSS file library, so as to avoid repeated wheel creation. The public picture library can be maintained by a designer, and the public JS/CSS file library can be maintained by a front-end engineer.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a page resource loading device for realizing the above-mentioned page resource loading method. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the method, so the specific limitation in the embodiment of the device for loading multiple page resources provided below can be referred to the limitation of the method for loading page resources in the above description, and will not be repeated here.
Fig. 7 is a block diagram of the structure of a loading device for page resources in an embodiment, and referring to fig. 7 in conjunction with fig. 1-3, in an exemplary embodiment, as shown in fig. 7, a loading device 200 for page resources is provided, which is applied to a client on a terminal 12, and includes: a data monitoring module 81, a resource requesting module 82, a resource pre-storing module 83 and a resource loading module 84, wherein:
the data monitoring module 81 is configured to monitor a usage condition of the processor by the client;
the resource request module 82 is configured to send a web address request to the server to obtain a web address of an index web page of the public resource when it is monitored that the usage rate of the processor by the client is lower than a set threshold; wherein, the server stores an index web page containing the resource address of each public resource;
The resource pre-storing module 83 is configured to access the index web page based on the web page address, and load the public resource corresponding to the resource address included in the index web page into the local memory cache;
the resource loading module 84 is configured to respond to a loading request of the H5 page resource, obtain the common resource from the memory cache when the requested H5 page resource includes the common resource, and display the corresponding H5 page based on the common resource.
Specifically, the data monitoring module 81 is configured to monitor a usage condition of a processor (CPU, central Processing Unit) of the client to the terminal, so as to determine a usage rate condition of the client to the processor in a certain period of time, thereby avoiding increasing a task processing requirement of the client when the client is in a busy period, avoiding a resource preemption condition, and thus being beneficial to ensuring a processing efficiency of a task being processed in the client, and ensuring a use experience of a user to the client.
The resource request module 82 is configured to, based on the data monitoring module 81 monitoring the usage of the processor by the client, send, to the processor, a task to be processed to execute when the usage of the processor by the client is monitored to be lower than a set threshold, that is, there is almost no interaction between the client and the user, and at the moment, the task processing requirement in the client is relatively low, and the processor of the client has enough capacity to process other tasks temporarily added by the client; the task sent by the client is to send a web page address request to the server to request the web page address of the index web page storing the resource address list of the public resource; according to the method and the device, the task of acquiring the webpage address is sent to the processor when the utilization rate of the client to the processor is lower than the set threshold, namely, when the processor of the client is idle, the webpage address can be acquired quickly, the execution efficiency of other tasks in the client cannot be influenced, normal execution of each task in the client is guaranteed, and the use experience of a user to the client is guaranteed.
It should be noted that the "sending a web address request to a server to obtain a web address of an index web page of a public resource" performed by the resource request module 82 is a step that is performed each time it is monitored that the usage rate of the client for the processor is lower than a set threshold, and is not a one-time execution step; by executing the request task for the web page address in the server under the condition that the use ratio of the client to the processor is monitored to be low, the obtained web page address can be updated continuously, so that the updated web page address can be updated to the client in the shortest time as possible, and synchronous update of the web page address in the client can be realized efficiently.
It should be added that the specific value of the set threshold is not limited, the size of the set threshold can be set according to the requirement, for example, the size of the set threshold can be determined according to historical statistical data in the client, so long as the processor of the client can have enough utilization rate to process the request task of the client to the web page address in the server.
The resource pre-storing module 83 is configured to access the index web page stored in the server based on the web page address after the resource requesting module 82 obtains the web page address of the index web page, so as to load the corresponding public resource to the local memory cache of the client through each resource address included in the index web page, so that the public resource can be stored in the client in advance, which is beneficial to facilitating the call of the public resource during the subsequent web page display, and improving the call speed of the public resource during the web page display.
Because the resource request module 82 dynamically updates the web page address requested to the client based on the utilization rate of the processor of the client, the public resources preloaded by the resource pre-storing module 83 are also dynamically and efficiently updated, which is beneficial to improving the updating efficiency of the public resources stored in the local memory cache, does not influence the processing rate of other tasks in the client, and is beneficial to improving the use experience of the user.
The resource loading module 84 is configured to, after the resource pre-storing module 83 stores the common resource in the local cache of the client, when there is an H5 page in the client that needs to be displayed, respond to a loading request of the H5 page resource, directly acquire the required common resource from the memory cache storing the common resource when the requested H5 page resource includes the common resource, and implement displaying of the corresponding H5 page based on the acquired common resource, thereby avoiding the need to go to acquire the corresponding resource through the server, and being beneficial to improving the loading speed of the H5 page, and simultaneously being capable of improving the use experience of the user for the client.
In one exemplary embodiment, the accessing of the index web page based on the web page address performed by the resource pre-store module 83 includes: the index web page is accessed based on the web page address by the hidden client container instance created by the client. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
In one exemplary embodiment, the common resources include function files, table files, and/or graphic files; the loading the common resources corresponding to the resource addresses contained in the index web page and executed by the resource pre-storing module 83 into the local memory cache includes: and loading the function file, the table file and/or the image file corresponding to the resource address contained in the index webpage into a local memory cache. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
In one exemplary embodiment, the resource request module 82 executes to send a web page address request to the server if the monitored client usage of the processor is below a set threshold, including: and sending a webpage address request to the server under the condition that the main thread of the client is monitored and the utilization rate of the processor is lower than a set threshold value in a preset time period. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
In one exemplary embodiment, the resource request module 82 executes to send a web page address request to the server if the monitored client usage of the processor is below a set threshold, including: and sending a webpage address request to the server under the condition that the main thread of the client is detected to be in a dormant state. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
In one exemplary embodiment, the monitoring of the usage of the processor by the client executed by the data monitoring module 81 includes: and under the condition that the client is in the home page display state, monitoring the use condition of the client for the processor. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
In one exemplary embodiment, the content executed by the resource loading module 84 further includes: in the case that the requested H5 page resource comprises a network resource, initiating a request for the network resource to the server; wherein the network resources do not belong to a common resource. Reference is made in particular to fig. 3, and to the description above in relation to fig. 3.
Fig. 8 is a block diagram of a loading device for a page resource according to another embodiment, referring to fig. 8 in conjunction with fig. 1 and 4, in an exemplary embodiment, as shown in fig. 8, a loading device 300 for a page resource is provided, and is applied to a server 14, and includes: a resource acquisition module 85 and a resource transmission module 86, wherein:
a resource obtaining module 85, configured to obtain a resource address of a public resource, and generate a public resource index web page based on the resource address; wherein, the index web page contains the resource address of each public resource;
The resource sending module 86 is configured to return, to the client, the web address of the index web page in response to the web address request of the client for the index web page.
Specifically, the resource obtaining module 85 is configured to obtain a resource address of a public resource, and then generate a public resource index web page based on the obtained plurality of resource addresses, that is, the index web page includes the resource address of each public resource; it should be added that the public resources can be stored in a public picture library and a public JS/CSS file library, wherein the public picture library can be maintained and managed by a designer, and the public JS/CSS file library can be maintained and managed by a front-end engineer, so that the designer and the front-end engineer can realize the operations of adding, deleting and updating files in the public picture library and the public JS/CSS file library.
The resource sending module 86 is configured to, after generating the index web page of the public resource in the server by the resource obtaining module 85, respond to the request of the client for the web address of the index web page when receiving the request of the client for the web address of the index web page, and feed back the web address of the index web page stored in the server to the client, so that the client can access the index web page through the web address, and facilitate the subsequent obtaining of the corresponding public resource by the resource address in the index web page.
In one exemplary embodiment, the generation of the common resource index web page based on the resource address by the resource acquisition module 85 includes: under the condition that the public resources in the public resource library are updated, updating the index web page based on the updated resource address of the public resources. Reference is made specifically to fig. 8 in conjunction with fig. 1, 5, and the description above with respect to fig. 1, 5, 8.
The above-mentioned respective modules in the loading device of the page resource may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Fig. 9 is an internal structural view of a computer device in one embodiment, and in one exemplary embodiment, a computer device, which may be a terminal, is provided, and the internal structural view thereof may be as shown in fig. 9. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program, when executed by a processor, implements a method of loading page resources. The display unit of the computer device is used for forming a visual picture, such as a page of a client, and the display unit can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
Fig. 10 is an internal structural view of a computer device in another embodiment, and in an exemplary embodiment, a computer device is provided, which may be the server 12 shown in fig. 1, and the internal structural view thereof may be as shown in fig. 10. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing various resources required for page presentation, such as data of a graph file, a table file, a function file and the like. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of loading page resources.
It will be appreciated by those skilled in the art that the structures shown in fig. 9 and 10 are merely block diagrams of portions of structures related to the aspects of the present application and are not intended to limit the computer device to which the aspects of the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or may have different arrangements of components.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for loading a page resource as described above, where the method for loading a page resource is any one of the methods for loading a page resource mentioned in the embodiments of the present application, and related embodiments may be referred to above.
In one embodiment, a computer program product is provided, which includes a computer program, where the computer program when executed by a processor implements the foregoing method for loading a page resource, where the method for loading a page resource is any one of the methods for loading a page resource mentioned in the embodiments of the present application, and related embodiments may be referred to above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use, and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive RandomAccess Memory, MRAM), ferroelectric Memory (Ferroelectric RandomAccess Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (RandomAccess Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static RandomAccess Memory, SRAM) or dynamic random access memory (Dynamic RandomAccess Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (14)

1. A method for loading a page resource, the method being applied to a client, the method comprising:
monitoring the use condition of the client to a processor;
sending a web page address request to a server under the condition that the use ratio of the client to the processor is lower than a set threshold value, so as to acquire the web page address of an index web page of a public resource; wherein the server stores the index web pages containing resource addresses of the public resources;
Accessing the index webpage based on the webpage address, and loading the public resource corresponding to the resource address contained in the index webpage into a local memory cache;
and responding to a loading request of the H5 page resource, acquiring the public resource from the memory cache under the condition that the requested H5 page resource comprises the public resource, and displaying the corresponding H5 page based on the public resource.
2. The method for loading page resources according to claim 1, wherein,
the accessing the index web page based on the web page address includes:
and accessing the index webpage based on the webpage address through the hidden client container instance created by the client.
3. The method for loading page resources according to claim 1, wherein the common resources include function files, table files and/or graphic files;
the loading the public resource corresponding to the resource address contained in the index web page into a local memory cache includes:
and loading the function file, the table file and/or the image file corresponding to the resource address contained in the index webpage into a local memory cache.
4. The method for loading page resources according to claim 1, wherein,
and sending a webpage address request to a server under the condition that the usage rate of the processor by the client is lower than a set threshold value, wherein the method comprises the following steps:
and sending a webpage address request to a server under the condition that the main thread of the client is monitored and the utilization rate of the processor is lower than a set threshold value in a preset time period.
5. The method for loading page resources according to claim 1, wherein,
and sending a webpage address request to a server under the condition that the usage rate of the processor by the client is lower than a set threshold value, wherein the method comprises the following steps:
and sending a webpage address request to a server under the condition that the main thread of the client is detected to be in a dormant state.
6. The method for loading page resources according to claim 1, wherein,
the monitoring the usage condition of the client to the processor comprises the following steps:
and under the condition that the client is in a home page display state, monitoring the use condition of the client for the processor.
7. The method for loading page resources according to any one of claims 1 to 6, further comprising:
In the case that the requested H5 page resource includes a network resource, initiating a request for the network resource to the server; wherein the network resource does not belong to the common resource.
8. A method for loading a page resource, the method being applied to a server, the method comprising:
acquiring a resource address of a public resource, and generating a public resource index webpage based on the resource address; wherein the index web page contains the resource address of each public resource;
responding to a webpage address request of a client for the index webpage, and returning the webpage address of the index webpage to the client.
9. The method for loading page resources according to claim 8, wherein,
the generating a public resource index web page based on the resource address includes:
and under the condition that the public resources in the public resource library are updated, updating the index web page based on the updated resource address of the public resources.
10. The loading device of the page resource is characterized by being applied to a client and comprising the following components:
the data monitoring module is used for monitoring the use condition of the client to the processor;
The resource request module is used for sending a webpage address request to a server under the condition that the use ratio of the client to the processor is lower than a set threshold value, so as to acquire the webpage address of an index webpage of the public resource; wherein the server stores the index web pages containing resource addresses of the public resources;
the resource pre-storing module is used for accessing the index web page based on the web page address, and loading the public resource corresponding to the resource address contained in the index web page into a local memory cache;
the resource loading module is used for responding to a loading request of the H5 page resource, acquiring the public resource from the memory cache under the condition that the requested H5 page resource comprises the public resource, and displaying the corresponding H5 page based on the public resource.
11. A loading device of page resources, which is applied to a server, and comprises:
the resource acquisition module is used for acquiring the resource address of the public resource and generating a public resource index webpage based on the resource address; wherein the index web page contains the resource address of each public resource;
and the resource sending module is used for responding to a webpage address request of the client for the index webpage and returning the webpage address of the index webpage to the client.
12. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 7 or 8 to 9 when the computer program is executed.
13. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7, or of claims 8 to 9.
14. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 7, or of claims 8 to 9.
CN202311409801.9A 2023-10-27 2023-10-27 Page resource loading method and device, computer equipment and storage medium Pending CN117331625A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311409801.9A CN117331625A (en) 2023-10-27 2023-10-27 Page resource loading method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311409801.9A CN117331625A (en) 2023-10-27 2023-10-27 Page resource loading method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117331625A true CN117331625A (en) 2024-01-02

Family

ID=89291656

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311409801.9A Pending CN117331625A (en) 2023-10-27 2023-10-27 Page resource loading method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117331625A (en)

Similar Documents

Publication Publication Date Title
US20240095043A1 (en) Execution of sub-application processes within application program
US20170153909A1 (en) Methods and Devices for Acquiring Data Using Virtual Machine and Host Machine
US11151314B2 (en) Extensible grid layout
US9503551B2 (en) Hybrid native networked applications
CN115344183A (en) Page sliding method, live broadcast page sliding method, device, equipment and medium
US10678750B2 (en) On demand file sync
CN114238815A (en) Page rendering method and device, computer equipment and storage medium
CN116127219A (en) Method and device for displaying pages in applet and computer equipment
CN117331625A (en) Page resource loading method and device, computer equipment and storage medium
CN115421693A (en) Method and device for realizing micro front-end architecture, computer equipment and storage medium
CN113961298A (en) Page switching method, device, equipment and medium
US11892981B2 (en) On demand file sync
CN112887376B (en) feed stream de-duplication method, device, system, computer equipment and storage medium
CN116541145A (en) Data calling method, device, computer equipment and computer storage medium
CN118193083A (en) Software resource loading method and device, computer equipment and storage medium
CN116546097A (en) Resource transmission control method and device and computer equipment
CN115630248A (en) Page determination method and device, computer equipment and storage medium
CN117349559A (en) Page display method and device, computer equipment and storage medium
CN116226187A (en) Data caching method, device, computer equipment and storage medium
CN115221222A (en) Receipt processing method and device, computer equipment and storage medium
US20200320148A1 (en) Multi-entry point navigation for user interfaces
CN116775186A (en) Page data processing method and device, computer equipment and storage medium
CN116400922A (en) Interface guide schematic diagram generation method, device, computer equipment and storage medium
CN115952773A (en) Form generation method and device
CN117807334A (en) First screen page display method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination