Movatterモバイル変換


[0]ホーム

URL:


CN113065083B - Page processing method and device, electronic equipment and storage medium - Google Patents

Page processing method and device, electronic equipment and storage medium
Download PDF

Info

Publication number
CN113065083B
CN113065083BCN202110223983.5ACN202110223983ACN113065083BCN 113065083 BCN113065083 BCN 113065083BCN 202110223983 ACN202110223983 ACN 202110223983ACN 113065083 BCN113065083 BCN 113065083B
Authority
CN
China
Prior art keywords
resource
text
page
current page
multimedia
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.)
Active
Application number
CN202110223983.5A
Other languages
Chinese (zh)
Other versions
CN113065083A (en
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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
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 Beijing Dajia Internet Information Technology Co LtdfiledCriticalBeijing Dajia Internet Information Technology Co Ltd
Priority to CN202110223983.5ApriorityCriticalpatent/CN113065083B/en
Publication of CN113065083ApublicationCriticalpatent/CN113065083A/en
Application grantedgrantedCritical
Publication of CN113065083BpublicationCriticalpatent/CN113065083B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The disclosure relates to a page processing method, a device, an electronic device and a storage medium, wherein the method comprises the following steps: monitoring a start processing event for a current page; determining a text resource identifier on which a current page depends when a processing starting event is monitored; the text resource corresponding to the text resource identifier is stored in a compiling resource table; acquiring text resources matched with the text resource identifiers from the compiling resource table, wherein the text resources comprise multimedia resource identifiers corresponding to the current page; searching each multimedia resource identifier in a compiled resource table in the text resource, and if the multimedia resource identifier is searched in the text resource, determining that the multimedia resource corresponding to the multimedia resource identifier is a target resource on which the current page depends; and declaring the target resource on which the current page depends as a preloading attribute in an entry file of the current page. The method and the device are beneficial to improving the utilization rate of network resources in the page preloading process and the page preloading efficiency.

Description

Page processing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a page processing method, a page processing device, electronic equipment and a storage medium.
Background
In a browser page, the network resources expected to be used can be declared as preloaded, so that the browser can load in idle time without affecting the current page loading.
In front-end engineering based on code compilation tool weback construction, plug-in html-weback-plug in is usually constructed by using plug-in auxiliary pages to automatically declare resources as preloaded. However, in the related art, only the resources such as pictures and videos which are used by each page determination cannot be declared as preloading, and the resources which cannot be used are not declared as preloading, so that waste of network resources exists in the page preloading process, and the network resource utilization rate and the preloading efficiency are reduced.
Disclosure of Invention
The disclosure provides a page processing method, a device, electronic equipment and a storage medium, which at least solve the problems of low network resource utilization rate and low preloading efficiency in the page preloading process in the related technology. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a page processing method, including:
Monitoring a start processing event for a current page;
determining a text resource identifier on which the current page depends when the processing event is monitored; the text resource corresponding to the text resource identifier is stored in a compiling resource table;
acquiring text resources matched with the text resource identifiers from the compiling resource table; the text resource matched with the text resource identifier comprises a multimedia resource identifier corresponding to the current page;
searching each multimedia resource identifier in the compiling resource table in the text resource, and if the multimedia resource identifier is searched in the text resource, determining that the multimedia resource corresponding to the multimedia resource identifier is the target resource on which the current page depends;
and declaring the target resource on which the current page depends as a preloading attribute in the entry file of the current page.
In an exemplary embodiment, the determining the text resource identifier on which the current page depends includes:
determining a data object in a page construction tool, wherein the page construction tool is used for constructing an entry file of the current page;
acquiring a resource code block from the data object;
Extracting script file identifiers and cascading style identifiers of the current page dependence from the resource code blocks to obtain a text resource identifier set of the current page dependence; the text resource identifiers in the text resource identifier set comprise the script file identifier and the cascading style identifier.
In an exemplary embodiment, the compiled resource table uses a resource identifier as a key, and the resource content corresponding to the resource identifier is recorded with the resource content relied by all pages in the application corresponding to the current page and the resource identifier corresponding to the resource content in the form of a value; the resource content comprises text resources and multimedia resources, and the resource identifiers comprise text resource identifiers corresponding to the text resources and multimedia resource identifiers corresponding to the multimedia resources;
the obtaining the text resource matched with the text resource identifier from the compiled resource table comprises the following steps:
traversing the text resource identifiers in the text resource identifier set;
for each traversed text resource identifier, determining a target value matched with a key in the compiling resource table by taking the text resource identifier as the key;
And acquiring the resource content corresponding to the target value to obtain the text resource matched with the text resource identification.
In an exemplary embodiment, the declaring, in the portal file of the current page, the target resource on which the current page depends as the preloaded attribute includes:
generating a link label according to the target resource on which the current page depends; the link tag comprises a first attribute and a second attribute, wherein the first attribute indicates preloading, and the second attribute indicates a target resource on which the current page depends;
and inserting the link label into a head node of the entry file corresponding to the target page.
In an exemplary embodiment, before declaring the target resource on which the current page depends as the preloaded attribute in the portal file of the current page, the method further includes:
monitoring a link tag change event for the portal file; the link tag change event is used for triggering the change of the link tag in the head node of the entry file;
and when the link tag change event is monitored, executing the step of declaring the target resource on which the current page depends as a preloading attribute in the portal file of the current page.
In an exemplary embodiment, the listening for a start processing event for a current page includes:
and monitoring a start processing event aiming at the current page through a page processing front hook function in the page construction tool.
According to a second aspect of the embodiments of the present disclosure, there is provided a page processing apparatus, including:
a first monitoring unit configured to perform monitoring of a start processing event for a target page;
a text resource identifier determining unit configured to determine a text resource identifier on which the current page depends when the start processing event is monitored; the text resource corresponding to the text resource identifier is stored in a compiling resource table;
a text resource obtaining unit configured to obtain a text resource matched with the text resource identifier from the compiled resource table; the text resource matched with the text resource identifier comprises a multimedia resource identifier corresponding to the current page;
the page dependent resource determining unit is configured to perform searching for each multimedia resource identifier in the compiling resource table in the text resource, and if the multimedia resource identifier is found in the text resource, determining that the multimedia resource corresponding to the multimedia resource identifier is the target resource on which the current page depends;
And the declaring unit is configured to execute declaring the target resource on which the current page depends as a preloading attribute in the portal file of the current page.
In an exemplary embodiment, the text resource identifier determining unit includes:
a data object determination unit configured to perform determination of a data object in a page building tool for building an entry file of the current page;
a resource code block acquisition unit configured to perform acquisition of a resource code block from the data object;
an extracting unit configured to extract script file identifiers and cascading style identifiers of the current page dependence from the resource code blocks to obtain a text resource identifier set of the current page dependence; the text resource identifiers in the text resource identifier set comprise the script file identifier and the cascading style identifier.
In an exemplary embodiment, the compiled resource table uses a resource identifier as a key, and the resource content corresponding to the resource identifier is recorded with the resource content relied by all pages in the application corresponding to the current page and the resource identifier corresponding to the resource content in the form of a value; the resource content comprises text resources and multimedia resources, and the resource identifiers comprise text resource identifiers corresponding to the text resources and multimedia resource identifiers corresponding to the multimedia resources;
The text resource obtaining unit includes:
a traversing unit configured to perform traversing the text resource identifiers in the text resource identifier set;
a value determining unit configured to perform determining, for each traversed text resource identifier, a target value in the compiled resource table that matches the key with the text resource identifier as the key;
and the first acquisition unit is configured to acquire the resource content corresponding to the target value and obtain the text resource matched with the text resource identification.
In an exemplary embodiment, the declaration unit includes:
a link tag generation unit configured to execute a generation of a link tag according to the target resource on which the current page depends; the link tag comprises a first attribute and a second attribute, wherein the first attribute indicates preloading, and the second attribute indicates a target resource on which the current page depends;
and the inserting unit is configured to perform the insertion of the link tag into the head node of the entry file corresponding to the target page.
In an exemplary embodiment, the apparatus further comprises:
a second monitoring unit configured to perform monitoring of a link tag change event for the entry file; the link tag change event is used for triggering the change of the link tag in the head node of the entry file;
And the execution unit is configured to execute the step of declaring the target resource on which the current page depends as a preloading attribute in the portal file of the current page when the link label change event is monitored.
In an exemplary embodiment, the first monitoring unit is specifically configured to perform monitoring of a start processing event for a current page by a page processing front hook function in the page building tool.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the page processing method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the page processing method of the first aspect described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the page processing method of the first aspect described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
by monitoring a start processing event aiming at a current page, determining a text resource identifier relied on by the current page when the start processing event is monitored, further acquiring text resources matched with the text resource identifier from a compiled resource table, searching each multimedia resource identifier in the compiled resource table in the text resources, if a certain multimedia resource identifier is searched in the text resources, determining that the multimedia resource corresponding to the multimedia resource identifier is a target resource relied on by the current page, further declaring the target resource relied on by the current page as a preloading attribute in an entry file of the current page, realizing that only the multimedia resource determined to be used by the current page is declared as preloading, eliminating the preloading declaration of the multimedia resources which cannot be used by the current page, and not preloading the multimedia resources which cannot be used by the current page, avoiding the waste of network resources caused by unnecessary resource preloading, and improving the utilization rate of network resources and the preloading efficiency of the page.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is a flow chart illustrating a method of page processing according to an exemplary embodiment;
FIG. 2 is a flowchart illustrating a determination of text resource identification of a current page dependency in accordance with an exemplary embodiment;
FIG. 3 is a flowchart illustrating declaring a target resource that is dependent on a current page as a preloaded attribute in an entry file for the current page according to an exemplary embodiment;
FIG. 4 is a block diagram of a page processing apparatus according to an exemplary embodiment;
FIG. 5 is a block diagram of a resource preloading plugin, shown according to one example embodiment;
fig. 6 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In the browser page, the network resources expected to be used can be declared as preloaded, so that the browser can perform early loading of the network resources declared as preloaded in idle time on the premise of not influencing the loading of the current page, and the rendering performance of the page is improved.
In the related art, in front-end engineering based on code compiling tool weback construction, a default preloading plugin preload-weback-plugin is usually used for assisting page construction plugin html-weback-plugin in weback to automatically declare resources as preloading. The preload-weback-plug in only supports 4 types of preloading declarations, if multimedia resources such as pictures, videos and the like are to be declared to be preloaded, all the declarations in the form of resource alloAssets are required to be adopted, and when the preloading declarations are all the resource alloAssets, each page can declare all the resources to be preloaded if a plurality of pages are applied, namely, the resources which are not used by the page can still be declared to be preloaded, the fact that only the multimedia resources such as pictures, videos and the like which are determined to be used by each page are declared to be preloaded cannot be realized, and all the resources are required to be preloaded when the pages are preloaded, so that the waste of network resources is caused, and the utilization rate of the network resources is reduced.
In view of this, the embodiments of the present disclosure provide a method for processing a page, by which a multimedia resource declaration that is only used for determining a page is preloaded, and a preloading declaration of a multimedia resource that is not possible to be used for the page is excluded, so that only the multimedia resource that is determined to be used is preloaded during the preloading process of the page, and the multimedia resource that is not possible to be used is not preloaded, which avoids the waste of network resources caused by unnecessary resource preloading, and improves the network resource utilization rate and preloading efficiency.
The page processing method of the embodiment of the disclosure may be implemented as a plug-in the code compiling tool weback, for example, may be referred to as a resource preloading plug-in, and the resource preloading plug-in may assist in implementing that only a target resource determined to be used in a page is declared as preloaded by a page building plug-in html-weback-plug in (or referred to as a page building tool) in the code compiling tool weback.
In practical application, when a browser loads a page, some multimedia resources such as pictures, videos and the like hidden in text resources such as cascading style CSS (Cascading Style Sheets) and script file JavaScript are required to be loaded by the browser after the text resources are parsed, so that it is necessary to declare the multimedia resources such as pictures, videos and the like hidden in the text resources and determined to be used by the corresponding page as preloaded under the scene. Based on this, in the embodiment of the present disclosure, the target resources declared by the resource preloading plugin are the multimedia resources determined to be used by the corresponding page in the cascading style CSS (Cascading Style Sheets) and the JavaScript of the script file, and generally, the multimedia resources such as pictures and videos in the text resources are generally in binary form, so these multimedia resources may also be referred to as binary resources.
Referring to FIG. 1, a flowchart of a page processing method is shown according to an exemplary embodiment, and as shown in FIG. 1, the method includes the steps of:
in step S11, a start processing event for the current page is monitored.
The current page is one page in the application compiled by the code compiling tool weback, and the page is a page to be processed currently by a page building plug-in html-weback-plug in the code compiling tool weback. By way of example, the application compiled by the code compilation tool weback may include a plurality of pages, which may be pages described in hypertext markup language (HyperText Markup Language, HTML).
Illustratively, in the code compiling tool weback, a page building plug-in html-weback-plug in is used for building an entry html file of a page, and some hook functions hook which can be called by other plug-ins are also provided in the page building plug-in html-weback-plug in, wherein the hook functions include a pre-page processing hook function html weback plug-in html processing, and the pre-page processing hook function is called before the page building plug-in html-plug in processes an html page.
Therefore, when the step S11 is implemented, the first preset hook function in the embodiment of the present disclosure may be a pre-page processing hook function htmlweback plugin provided in a page building plug-in html-weback-plugin for building a target page, and the processing event started for the current page may be monitored by a pre-page processing hook function htmlweback plugin webeforhlprocessing provided in a page building tool html-weback-plugin.
In step S12, when the processing starting event is monitored, determining a text resource identifier on which the current page depends, where the text resource corresponding to the text resource identifier is stored in a compiled resource table.
Illustratively, when the hook before page processing function htmlweback plugin before page processing triggers, it indicates that a processing event of the beginning of the current page is monitored, at this time, the resource preloading plugin may determine a text resource identifier that is used to uniquely identify the text resource that is relied on by the current page, where the text resource may include a JavaScript script file and a cascading style CSS file.
In an exemplary embodiment, the step S12 may include the following steps in fig. 2 when determining the text resource identifier that the current page depends on:
In step S121, a data object in the page building tool is determined.
The page building tool is used for building an entry file of the target page, and specifically, the page building tool may be a page building plug-in html-weback-plug in used for building the entry file of the target html page.
In step S122, resource code blocks are acquired from the data object.
In step S123, extracting the script file identifier and the cascading style identifier of the current page dependency from the resource code block, to obtain a text resource identifier set of the current page dependency; the text resource identifiers in the text resource identifier set comprise the script file identifier and the cascading style identifier.
Specifically, the page building plug-in html-weback-plugin exposes a data object html plugindata, in which all script file identifications and cascading style identifications relied on by the current page are stored through a resource code block html plugindata. Assemts. Chunks, but the resource code block does not store related resource identifications of other non-text resources (such as picture resources, animation resources and other multimedia resources), so that a text resource identification set relied on by the current page can be obtained by extracting the script file identifications and the cascading style identifications relied on by the current page from the resource code block html plugindata. Chunks. It should be noted that, the above-mentioned resource code block htmlPluginData. Assets. Chunks only includes the text resource identifier, and does not include the text resource corresponding to the text resource identifier, and the text resource corresponding to the text resource identifier is stored in the compiled resource table, and the compiled resource table will be described in the subsequent steps.
The text resource identifier may be, for example, a name of the text resource, such as a file name of a JavaScript script file, a file name of a CSS file.
In practical applications, the structures of the JavaScript script file and the CSS file in the resource code block htmlPlugindata. For a JavaScript script file, it is a single JavaScript file name, and for a CSS file, it is an array of multiple CSS file names, so that a text resource identifier set that depends on a current page can be extracted through a resource code block htmlplugindata.
In step S13, a text resource matching the text resource identifier is obtained from the compiled resource table.
And the text resource matched with the text resource identifier comprises a multimedia resource identifier corresponding to the current page.
Specifically, in the process of compiling an application corresponding to a current page by using a code compiling tool weback, a compiling object, namely a compiling object, can be obtained from the context of the code compiling tool weback, the compiling object represents a single process of compiling and generating compiling resources, in the compiling object, the resource content relied by all pages in the application corresponding to the current page and the resource identifier corresponding to the resource content are recorded through a compiling resource table compiling. Assets, wherein the resource content comprises text resources and multimedia resources, the resource identifier comprises text resource identifiers corresponding to the text resources and multimedia resource identifiers corresponding to the multimedia resources, that is, the compiling resource table compiling. Assets does not distinguish pages when recording, and all resources (namely text resources and multimedia resources) relied by all pages in the compiling application are recorded.
In practical application, the compiling resource table accounting, packages, uses the resource identifier as a key, and the resource content corresponding to the resource identifier is a value to record the resource content relied on by all pages in the application corresponding to the current page and the resource identifier corresponding to the resource content, so in an exemplary embodiment, the step S13 may include the following steps when implemented:
(1) Traversing the text resource identification set relied on by the current page.
(2) And for each traversed text resource identifier, determining a target value matched with the key in the compiled resource table by taking the text resource identifier as the key.
(3) And acquiring the resource content corresponding to the target value to obtain text resources matched with the text resource identifiers, and then obtaining the text resources corresponding to each text resource identifier in the text resource identifier set when the traversal is finished.
Since the text resource identifier points to the text resource on which the current page depends, namely the JavaScript script file and the CSS file on which the current page depends, can be accurately found from all pages related in the current compiling process through the steps.
In step S14, each multimedia resource identifier in the compiled resource table is searched in the text resource, and if the multimedia resource identifier is found in the text resource, it is determined that the multimedia resource corresponding to the multimedia resource identifier is the target resource on which the current page depends.
Because the compiled resource table records the resource content and the resource identifier corresponding to the resource content which are relied on by all the pages in the application corresponding to the current page, namely the resource identifier appearing in the compiled resource table is certainly the resource identifier corresponding to the resource which is relied on by a certain page in the compiled application, namely the resource corresponding to the resource identifier is certainly used in the certain page, the resource content in the compiled resource table comprises text resource and multimedia resource, the resource identifier corresponding to the resource content comprises text resource identifier and multimedia resource identifier, and then, by searching each multimedia resource in the compiled resource table in the text resource which is relied on by the current page, if a certain multimedia resource identifier in the compiled resource table is searched in the text resource which is relied on by the current page, the multimedia resource corresponding to the multimedia resource identifier can be determined to be the target resource which is relied on by the current page.
In step S15, the target resource on which the current page depends is declared as a preloading attribute in the portal file of the current page.
In an exemplary embodiment, when the target resource on which the current page depends is declared as the preloading attribute in the portal file of the current page, the following steps in fig. 3 may be included:
In step S151, a link tag is generated according to the target resource on which the current page depends.
The link tag comprises a first attribute and a second attribute, wherein the first attribute indicates preloading, and the second attribute indicates a target resource on which the current page depends.
In step S152, the link tag is inserted into the header node of the portal file corresponding to the target page.
Illustratively, when the current page is an html page, the pre-load resource may be declared in the head node head of the portal file of the html page by a link tag in which the pre-load may be indicated by a rel attribute (i.e., a first attribute) and the target resource on which the current page depends may be indicated by an href attribute (i.e., a second attribute).
Based on this, in an exemplary embodiment, as shown in the flowchart of another page processing method provided in fig. 4, before declaring the target resource on which the current page depends as the preloading attribute in the portal file of the current page, the method may further include the following steps:
in step S16, a link tag change event for the portal file is monitored.
Wherein the link tag change event is used to trigger a change to a link tag in a head node of the portal file. When the link tag change event is monitored, the foregoing step S15 in the embodiment of the present disclosure may be performed, where the target resource on which the current page depends is declared as a preloaded attribute in the portal file of the current page.
In practical application, the hook function provided in the page building plug-in html-weback-plug in includes a link tag modification hook function htmlweback plug in alterassettags, and the link tag in the head node of the entry file of the current page can be modified by taking the trigger of the link tag modification hook function htmlweback plug in alterassettags as an in-point. Thus, the link tag change event for the portal file of the current page may be listened to by the link tag change hook function htmlweback plugin alterassettags provided in the page building tool.
The embodiment of the disclosure realizes that only the multimedia resource statement used for determining the current page is preloaded, and excludes the preloading statement of the multimedia resource which cannot be used by the current page, so that the multimedia resource used for determining the current page is only preloaded in the preloading process of the current page, and the multimedia resource which cannot be used is not preloaded, thereby avoiding the waste of network resources caused by unnecessary resource preloading, and improving the utilization rate of the network resources and the preloading efficiency of the page.
Fig. 4 is a block diagram illustrating a page processing apparatus according to an exemplary embodiment. Referring to fig. 5, the page processing apparatus 500 includes a first listening unit 410, a text resource identification determining unit 420, a text resource acquiring unit 430, a page dependent resource determining unit 440, and a sound unit 450.
The first monitor unit 410 is configured to perform monitoring of a start processing event for a target page;
the text resource identifier determining unit 420 is configured to determine a text resource identifier on which the current page depends when the start processing event is monitored; the text resource corresponding to the text resource identifier is stored in a compiling resource table;
the text resource obtaining unit 430 is configured to obtain a text resource matched with the text resource identifier from the compiled resource table; the text resource matched with the text resource identifier comprises a multimedia resource identifier corresponding to the current page;
the page dependent resource determining unit 440 is configured to perform searching for each multimedia resource identifier in the compiled resource table in the text resource, and if the multimedia resource identifier is found in the text resource, determine that the multimedia resource corresponding to the multimedia resource identifier is the target resource on which the current page depends;
the declaring unit 450 is configured to perform declaring, in the portal file of the current page, that the target resource on which the current page depends is a preloaded attribute.
In an exemplary embodiment, the text resource identification determining unit 420 includes:
a data object determination unit configured to perform determination of a data object in a page building tool for building an entry file of the current page;
a resource code block acquisition unit configured to perform acquisition of a resource code block from the data object;
an extracting unit configured to extract script file identifiers and cascading style identifiers of the current page dependence from the resource code blocks to obtain a text resource identifier set of the current page dependence; the text resource identifiers in the text resource identifier set comprise the script file identifier and the cascading style identifier.
In an exemplary embodiment, the compiled resource table uses a resource identifier as a key, and the resource content corresponding to the resource identifier is recorded with the resource content relied by all pages in the application corresponding to the current page and the resource identifier corresponding to the resource content in the form of a value; the resource content comprises text resources and multimedia resources, and the resource identifiers comprise text resource identifiers corresponding to the text resources and multimedia resource identifiers corresponding to the multimedia resources;
The text resource acquiring unit 430 includes:
a traversing unit configured to perform traversing the text resource identifiers in the text resource identifier set;
a value determining unit configured to perform determining, for each traversed text resource identifier, a target value in the compiled resource table that matches the key with the text resource identifier as the key;
and the first acquisition unit is configured to acquire the resource content corresponding to the target value and obtain the text resource matched with the text resource identification.
In an exemplary embodiment, the declaration unit 450 includes:
a link tag generation unit configured to execute a generation of a link tag according to the target resource on which the current page depends; the link tag comprises a first attribute and a second attribute, wherein the first attribute indicates preloading, and the second attribute indicates a target resource on which the current page depends;
and the inserting unit is configured to perform the insertion of the link tag into the head node of the entry file corresponding to the target page.
In an exemplary embodiment, the apparatus further comprises:
a second monitoring unit configured to perform monitoring of a link tag change event for the entry file; the link tag change event is used for triggering the change of the link tag in the head node of the entry file;
And the execution unit is configured to execute the step of declaring the target resource on which the current page depends as a preloading attribute in the portal file of the current page when the link label change event is monitored.
In an exemplary embodiment, the first listening unit 410 is specifically configured to execute listening for a start processing event for a current page by means of a page processing front hook function in the page building tool.
It should be noted that, in the apparatus provided in the foregoing embodiment, when implementing the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above.
The page processing device of the embodiment of the disclosure may be a resource preloading plugin, and the resource preloading plugin may assist a page building plugin html-weback-plug in a code compiling tool weback to implement that only multimedia resources such as pictures, animations and the like which are determined to be used in html pages are preloaded based on the page processing method of the embodiment of the disclosure.
FIG. 5 is a block diagram of a resource preloading plugin that may include an Html hand-in module and a resource screening module, as shown in FIG. 5, according to one example embodiment.
The Html cutting-in module is responsible for communicating with the Html-weback-plug in of the page building plug-in to cut into the processing procedure of the Html page at an appropriate time. Specifically, the Html cut-in module may monitor, through a pre-page processing hook function htmlweback plugin Html-weback-plug in, a start processing event and a link tag change event of the page building plugin Html-weback-plug in for a current Html page, respectively, by link tag change hook function htmlweback plugin Html processing. When the Html cut-in module monitors a processing starting event of the current Html page, the resource screening module is called to accurately determine the multimedia resources such as pictures, animations and the like used by the current Html page through the resource screening module. When the Html cut-in module monitors a link label change event of a current Html page, the determined multimedia resources such as pictures and animations used by the current Html page are inserted into a head node of an entry file of the current Html page in a link label mode. It will be appreciated that the Html cut-in module may be used to implement the functions associated with the first monitor unit 410 and the declaring unit 450 in the page processing apparatus 400.
The resource filtering module is responsible for determining multimedia resources such as pictures, animations and the like used for determining the current html page, that is, the resource filtering module can be used for realizing the related functions of the text resource identification determining unit 420, the text resource obtaining unit 430 and the page dependent resource determining unit 440 in the page processing device.
According to the page processing device, a text resource identifier which is depended on a current page is determined by monitoring a starting processing event aiming at the current page, when the starting processing event is monitored, further text resources which are matched with the text resource identifier are obtained from a compiling resource table, each multimedia resource identifier in the compiling resource table is searched in the text resources, if a certain multimedia resource identifier is searched in the text resources, the multimedia resource corresponding to the multimedia resource identifier is determined to be a target resource which is depended on the current page, further the target resource which is depended on the current page is declared to be a preloading attribute in an entry file of the current page, the fact that only the multimedia resource which is determined to be used by the current page is declared to be preloaded is achieved, and preloading declaration of the multimedia resource which is impossible to be used by the current page is eliminated, so that preloading is only carried out on the multimedia resource which is determined to be used in the preloading process of the current page, unnecessary preloading is not carried out on the multimedia resource which is impossible to be used, waste of network resources caused by unnecessary preloading is avoided, and the network resource utilization rate and the page preloading efficiency are improved.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
In an exemplary embodiment, there is also provided an electronic device including a processor; a memory for storing processor-executable instructions; the processor is configured to implement the page processing method provided in any of the above embodiments when executing the instructions stored on the memory.
The electronic device may be a terminal, a server or a similar computing device, taking the electronic device as an example of a terminal, fig. 6 is a block diagram of an electronic device for page processing, in particular:
the terminal can include RF (Radio Frequency) circuitry 610, memory 620 including one or more computer-readable storage media, input unit 630, display unit 640, sensor 650, audio circuitry 660, wiFi (wireless fidelity ) module 670, processor 680 including one or more processing cores, and power supply 690. It will be appreciated by those skilled in the art that the terminal structure shown in fig. 6 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
The RF circuit 610 may be used for receiving and transmitting signals during the process of receiving and transmitting information or communication, in particular, after receiving downlink information of the base station, the downlink information is processed by one or more processors 680; in addition, data relating to uplink is transmitted to the base station. Typically, RF circuitry 610 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier ), a duplexer, and the like. In addition, the RF circuit 610 may also communicate with networks and other terminals through wireless communication. The wireless communication may use any communication standard or protocol including, but not limited to, GSM (Global System of Mobile communication, global system for mobile communications), GPRS (General Packet Radio Service ), CDMA (Code Division Multiple Access, code division multiple access), WCDMA (Wideband Code Division Multiple Access ), LTE (Long Term Evolution, long term evolution), email, SMS (Short Messaging Service, short message service), and the like.
The memory 620 may be used to store software programs and modules, and the processor 680 may perform various functional applications and data processing by executing the software programs and modules stored in the memory 620. The memory 620 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for functions, and the like; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 620 may also include a memory controller to provide access to the memory 620 by the processor 680 and the input unit 630.
The input unit 630 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 630 may include a touch-sensitive surface 631 and other input devices 632. The touch-sensitive surface 631, also referred to as a touch display screen or a touch pad, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the touch-sensitive surface 631 or thereabout using any suitable object or accessory such as a finger, stylus, etc.), and actuate the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 631 may comprise two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 680 and can receive commands from the processor 680 and execute them. In addition, the touch sensitive surface 631 may be implemented in various types of resistive, capacitive, infrared, surface acoustic wave, and the like. In addition to the touch-sensitive surface 631, the input unit 630 may also comprise other input devices 632. In particular, other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
The display unit 640 may be used to display information input by a user or information provided to the user and various graphical user interfaces of the terminal, which may be composed of graphics, text, icons, video, and any combination thereof. The display unit 640 may include a display panel 641, and optionally, the display panel 641 may be configured in the form of an LCD (Liquid Crystal Display ), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch sensitive surface 631 may overlay the display panel 641, and upon detection of a touch operation thereon or thereabout by the touch sensitive surface 631, the touch sensitive surface is communicated to the processor 680 to determine the type of touch event, and the processor 680 then provides a corresponding visual output on the display panel 641 based on the type of touch event. Wherein the touch-sensitive surface 631 and the display panel 641 may be two separate components for input and input functions, but in some embodiments the touch-sensitive surface 631 may be integrated with the display panel 641 for input and output functions.
The terminal may also include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors. In particular, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 641 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 641 and/or the backlight when the terminal moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and the direction when the device is stationary, and the device can be used for applications of recognizing the gesture of a terminal (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may be configured for the terminal are not described in detail herein.
Audio circuitry 660, speaker 661, microphone 662 may provide an audio interface between a user and the terminal. The audio circuit 660 may transmit the received electrical signal converted from audio data to the speaker 661, and the electrical signal is converted into a sound signal by the speaker 661 to be output; on the other hand, microphone 662 converts the collected sound signals into electrical signals, which are received by audio circuit 660 and converted into audio data, which are processed by audio data output processor 680 for transmission to, for example, another terminal via RF circuit 610, or which are output to memory 620 for further processing. Audio circuitry 660 may also include an ear bud jack to provide communication of a peripheral ear bud with the terminal.
WiFi belongs to a short-distance wireless transmission technology, and the terminal can help a user to send and receive e-mails, browse web pages, access streaming media and the like through a WiFi module 670, so that wireless broadband Internet access is provided for the user. Although fig. 6 shows a WiFi module 670, it will be understood that it does not belong to the essential constitution of the terminal, and can be omitted entirely as required within the scope of not changing the essence of the invention.
Processor 680 is a control center of the terminal, connects various parts of the entire terminal using various interfaces and lines, and performs various functions of the terminal and processes data by running or executing software programs and/or modules stored in memory 620, and calling data stored in memory 620, thereby performing overall monitoring of the terminal. Optionally, processor 680 may include one or more processing cores; preferably, the processor 680 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 680.
The terminal also includes a power supply 690 (e.g., a battery) for powering the various components, which may be logically connected to processor 680 via a power management system, such as a power management system that performs functions such as charge, discharge, and power management. The power supply 690 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal may further include a camera, a bluetooth module, etc., which will not be described herein. In particular, in this embodiment, the terminal further includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors. The one or more programs described above include instructions for performing the page processing method provided by the method embodiments described above.
In an exemplary embodiment, a computer readable storage medium is also provided, such as memory 620, including instructions executable by processor 680 of apparatus 600 to perform the above-described method. Alternatively, the computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, there is also provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the page processing method provided in any of the above embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

CN202110223983.5A2021-02-262021-02-26Page processing method and device, electronic equipment and storage mediumActiveCN113065083B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110223983.5ACN113065083B (en)2021-02-262021-02-26Page processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110223983.5ACN113065083B (en)2021-02-262021-02-26Page processing method and device, electronic equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN113065083A CN113065083A (en)2021-07-02
CN113065083Btrue CN113065083B (en)2023-10-31

Family

ID=76559226

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110223983.5AActiveCN113065083B (en)2021-02-262021-02-26Page processing method and device, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN113065083B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113326456B (en)*2021-07-082022-01-21北京达佳互联信息技术有限公司Webpage resource acquisition method, device, equipment, system and storage medium
CN114510667A (en)*2022-01-302022-05-17口碑(上海)信息技术有限公司 Page caching method, page display method and device, and storage medium
CN115113865A (en)*2022-06-292022-09-27中国银行股份有限公司 Front-end page management method, device and device based on financial system

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104991916A (en)*2015-06-242015-10-21小米科技有限责任公司Webpage loading method and apparatus
CN106611032A (en)*2015-10-272017-05-03广州市动景计算机科技有限公司Webpage pre-loading method and device
CN107451296A (en)*2017-08-212017-12-08南京焦点领动云计算技术有限公司A kind of Website Module rendering intent based on component
CN110020108A (en)*2017-09-122019-07-16腾讯科技(深圳)有限公司Network resource recommended method, device, computer equipment and storage medium
CN111046308A (en)*2019-11-062020-04-21天津幸福生命科技有限公司Page loading method and device
CN111881391A (en)*2020-06-122020-11-03马上消费金融股份有限公司Static network resource preloading method, data model training method and device
CN112015485A (en)*2020-08-142020-12-01北京达佳互联信息技术有限公司Page display method and device, electronic equipment and storage medium
CN112099790A (en)*2020-09-102020-12-18北京百度网讯科技有限公司 Method, apparatus, device and storage medium for determining page subject

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US12278861B2 (en)*2018-12-242025-04-15DigitalOcean, LLCMethod and system for addressing and executing serverless functions

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104991916A (en)*2015-06-242015-10-21小米科技有限责任公司Webpage loading method and apparatus
CN106611032A (en)*2015-10-272017-05-03广州市动景计算机科技有限公司Webpage pre-loading method and device
CN107451296A (en)*2017-08-212017-12-08南京焦点领动云计算技术有限公司A kind of Website Module rendering intent based on component
CN110020108A (en)*2017-09-122019-07-16腾讯科技(深圳)有限公司Network resource recommended method, device, computer equipment and storage medium
CN111046308A (en)*2019-11-062020-04-21天津幸福生命科技有限公司Page loading method and device
CN111881391A (en)*2020-06-122020-11-03马上消费金融股份有限公司Static network resource preloading method, data model training method and device
CN112015485A (en)*2020-08-142020-12-01北京达佳互联信息技术有限公司Page display method and device, electronic equipment and storage medium
CN112099790A (en)*2020-09-102020-12-18北京百度网讯科技有限公司 Method, apparatus, device and storage medium for determining page subject

Also Published As

Publication numberPublication date
CN113065083A (en)2021-07-02

Similar Documents

PublicationPublication DateTitle
US11025963B2 (en)Data processing method, apparatus, and system for live streaming page
CN113065083B (en)Page processing method and device, electronic equipment and storage medium
CN105429775B (en)Method and device for reporting log
CN107229618B (en)Method and device for displaying page
CN108984374B (en)Method and system for testing database performance
CN109800030B (en)Application program running method and device and terminal
CN113313804B (en)Image rendering method and device, electronic equipment and storage medium
CN104066009A (en)Method, device, terminal, server and system for program identification
CN108304369B (en)File type identification method and device
CN104636664A (en)Cross-site scripting vulnerability detection method and device based on file object model
CN104123276A (en)Method, device and system for intercepting popup windows in browser
CN105701153A (en)Method and device for reading webpage resources and electronic equipment
CN110198324B (en)Data monitoring method and device, browser and terminal
CN110347578B (en)Application testing method and device and storage medium
CN112749074B (en)Test case recommending method and device
CN103455602A (en)Video URL (Uniform Resource Locator) capturing method and device and terminal equipment
CN111273955A (en)Thermal restoration plug-in optimization method and device, storage medium and electronic equipment
CN112965756B (en)Page resource loading amount monitoring method and device, electronic equipment and storage medium
CN109450853B (en)Malicious website determination method and device, terminal and server
CN109803173B (en)Video transcoding method and device and storage device
CN109240986B (en)Log processing method and device and storage medium
CN114385478B (en)Data acquisition reporting method and device, electronic equipment and storage medium
CN116070052A (en)Interface data transmission method, device, terminal and storage medium
CN103530152A (en)Method, device and terminal device for loading client-side scripts
CN115878457A (en)Test data verification method and device, electronic equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp