CN113326456A - Webpage resource acquisition method, device, equipment, system and storage medium - Google Patents
Webpage resource acquisition method, device, equipment, system and storage medium Download PDFInfo
- Publication number
- CN113326456A CN113326456A CN202110773518.9A CN202110773518A CN113326456A CN 113326456 A CN113326456 A CN 113326456A CN 202110773518 A CN202110773518 A CN 202110773518A CN 113326456 A CN113326456 A CN 113326456A
- Authority
- CN
- China
- Prior art keywords
- webpage
- resource
- target
- compiled
- static
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
- G06F16/9566—URL specific, e.g. using aliases, detecting broken or misspelled links
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F16/986—Document structures and storage, e.g. HTML extensions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Human Computer Interaction (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The disclosure relates to a method, a device, equipment, a system and a storage medium for acquiring webpage resources, relates to the technical field of internet, and can accurately acquire static resources quoted by webpages, and the acquired static resources do not have the problems of omission or redundancy. The specific scheme is applied to the server and comprises the following steps: receiving an acquisition request from the electronic equipment; responding to the acquisition request, reading the total corresponding relation, obtaining target indication information corresponding to the target webpage, and sending the target indication information to the electronic equipment; receiving at least one resource acquisition request from an electronic device; responding to each resource acquisition request, and acquiring and sending a static resource quoted by a target webpage to the electronic equipment; whether the at least one static resource is successfully transmitted to the electronic equipment is used for representing the downloading progress of the at least one static resource.
Description
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, a system, and a storage medium for acquiring a web resource.
Background
When an application program (e.g., a browser) running in an electronic device receives an access operation of a user to a certain webpage, a static Resource list of a Uniform Resource Locator (URL) including a static Resource referred by the webpage is obtained first; and reloading the URL of each static resource in the static resource list so as to send a downloading request for requesting to acquire the static resource to the corresponding server. And when the static resources in the static resource list are downloaded, the electronic equipment displays the static resources in the webpage.
Generally, the method for acquiring the static resource list by the electronic device is as follows: receiving a compiled document related to the webpage from a server corresponding to the webpage, wherein the compiled document comprises a Hyper Text Markup Language (HTML) document; and then, the electronic equipment traverses the static resources in the HTML document to generate the static resource list.
However, in practical applications, the HTML document obtained by the above method may only include a part of the static resources referred by the web page, or may include other static resources not belonging to the web page. Therefore, the electronic equipment utilizes the static resource list to request the static resources acquired to have the problem of omission or redundancy, the page display of the webpage is influenced, and the browsing experience of the webpage by the user is further reduced.
Disclosure of Invention
The disclosure provides a method, a device, equipment, a system and a storage medium for acquiring webpage resources, so as to at least accurately acquire static resources quoted by a webpage, and the acquired static resources do not have the problems of omission or redundancy. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a method for acquiring a web page resource, where the method is applied to a server, and the method includes: receiving an acquisition request from the electronic equipment; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage; responding to the acquisition request, reading the total corresponding relation, obtaining target indication information corresponding to the target webpage, and sending the target indication information to the electronic equipment; receiving at least one resource acquisition request from an electronic device; each resource acquisition request in the at least one resource acquisition request is used for requesting to acquire a static resource quoted by the target webpage; and responding to each resource acquisition request, acquiring and sending one static resource referenced by the target webpage to the electronic equipment.
The total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The at least one web page includes a target web page. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage. Whether the at least one static resource is successfully transmitted to the electronic equipment is used for representing the downloading progress of the at least one static resource.
In one possible embodiment, the output content is at least one resource directory corresponding to at least one web page. Before receiving the acquisition request from the electronic device, the method further includes: acquiring a development document of a webpage project; determining at least one resource directory; compiling a development document, and correspondingly storing compiled indication information of static resources quoted by at least one compiled webpage into at least one resource directory according to the corresponding relation between the at least one webpage and the indication information quoted by the at least one webpage before compiling to obtain at least one updated resource directory; and obtaining the total corresponding relation according to the updated at least one resource directory.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage. The at least one resource directory is in one-to-one correspondence with the at least one web page.
In another possible implementation, the obtaining the total correspondence according to the updated at least one resource directory includes: traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain a compiled name of the static resource quoted by each webpage; and generating the compiled URL of the static resource quoted by each webpage according to the preset URL prefix and the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between at least one webpage and the compiled URL of the static resource quoted by at least one webpage is the total corresponding relation.
The preset URL prefix refers to an address of a static resource which is stored in the network and is referred by at least one webpage.
In another possible implementation, the obtaining the total correspondence according to the updated at least one resource directory includes: and traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between the compiled names of the static resource quoted by the at least one webpage and the at least one webpage is the total corresponding relation.
In another possible implementation, the output content is a compiled name of the static resource. Before the receiving of the acquisition request from the electronic device, the method further includes: acquiring a development document of a webpage project; compiling a development document, and marking the compiled name of the static resource to be compiled with the corresponding webpage identifier according to the corresponding relationship between the at least one webpage and the pre-compiled indication information of the static resource quoted by the at least one webpage; and obtaining the total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage.
In another possible implementation, the reading the total corresponding relationship to obtain the target indication information corresponding to the target webpage includes: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage into a preset document; and acquiring the URL of the preset document, and determining the URL of the preset document as target indication information.
The URL of the preset document represents an address where the preset document is stored.
In another possible implementation, the reading the total corresponding relationship to obtain the target indication information corresponding to the target webpage includes: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; determining a compiled document of a target webpage; compiling the compiling document of the target webpage is obtained by compiling the development document; and storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage to an entry position of a hypertext markup language document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determining the modified compiled document of the target webpage as the target indication information.
According to a second aspect of the embodiments of the present disclosure, there is provided a method for acquiring a web page resource, where the method is applied to an electronic device, and the method includes: responding to the access operation of the target webpage, and sending an acquisition request to a server; receiving target indication information from a server; acquiring a URL (uniform resource locator) of at least one static resource quoted by the target webpage according to the target indication information; loading the URL of at least one static resource to send at least one resource acquisition request to a server; the resource acquisition request is used for requesting to acquire a corresponding static resource; determining the processing state of at least one resource acquisition request, and determining the downloading progress of at least one static resource according to the processing state of at least one resource acquisition request; the processing state of the resource acquisition request is the successful downloading or the failed downloading of the corresponding static resource.
The obtaining request is used for requesting to obtain compiled indication information of the static resource quoted by the target webpage. And the target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage. The target indication information is obtained from the overall correspondence. The total correspondence is used for representing compiled indication information of static resources respectively quoted by at least one webpage in the webpage items. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The target web page belongs to at least one web page.
In a possible implementation, the target indication information is a URL of a preset document, and the preset document is used for storing compiled indication information of at least one static resource referenced by the target webpage. The obtaining, according to the target indication information, the URL of the at least one static resource referred by the target web page includes: loading a URL of a preset document to send a document acquisition request to a server; the document acquisition request is used for requesting to acquire a preset document; receiving a preset document from a server; and acquiring the URL of the at least one static resource quoted by the target webpage according to the compiled indication information of the at least one static resource quoted by the target webpage.
In another possible implementation, the target indication information is a modified compiled document of the target web page; compiled indication information of at least one static resource referenced by the target webpage is stored at an entry position of the hypertext markup language document in the modified compiled document of the target webpage. The obtaining, according to the target indication information, the URL of the at least one static resource referred by the target web page includes: and acquiring the URL of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the revised compiled document of the target webpage.
In another possible embodiment, the compiled indication information of the at least one static resource referred by the target webpage is a compiled name of the at least one static resource or a URL of the at least one static resource. The obtaining the URL of the at least one static resource referenced by the target web page according to the compiled indication information of the at least one static resource referenced by the target web page includes: under the condition that the compiled indication information of the at least one static resource quoted by the target webpage is the compiled name of the at least one static resource, generating a compiled URL of the at least one static resource quoted by the target webpage according to a preset URL prefix and the compiled name of the at least one static resource quoted by the target webpage; in a case that the compiled indication information of the at least one static resource referred to by the target webpage is a URL of the at least one static resource, it is determined that the compiled indication information of the at least one static resource referred to by the target webpage is the URL of the at least one static resource referred to by the target webpage.
The preset URL prefix refers to an address of at least one static resource referenced by a target webpage stored on a network.
In another possible implementation, after the loading the URL of the at least one static resource to send the at least one resource obtaining request to the server, the method further includes: counting the number of processing completion according to the processing state of at least one resource acquisition request; the processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading; dividing the processing completion number by the total number of the at least one resource acquisition request to obtain a processing completion ratio; and displaying the processing completion ratio or prompt information for representing the processing completion ratio.
In another possible implementation, after sending the obtaining request to the server, the method further includes: a compiled document of a target web page is received from a server. After the loading the URL of the at least one static resource to send the at least one resource obtaining request to the server, the method further includes: receiving a static resource referenced by a target webpage from a server; and generating and displaying the page of the target webpage according to the compiled document of the target webpage and the acquired static resource quoted by the target webpage.
In another possible implementation, after the loading the URL of the at least one static resource to send the at least one resource obtaining request to the server, the method further includes: receiving a static resource referenced by a target webpage from a server; and generating and displaying the page of the target webpage according to the modified compiled document of the target webpage and the acquired static resource quoted by the target webpage.
According to a third aspect of the embodiments of the present disclosure, there is provided a web resource obtaining apparatus, applied to a server, the apparatus including: the device comprises a receiving module, a request processing module and a sending module.
The receiving module is used for receiving an acquisition request from the electronic equipment; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage. And the request processing module is used for responding to the acquisition request, reading the total corresponding relation and obtaining the target indication information corresponding to the target webpage. And the sending module is used for sending the target indication information to the electronic equipment. The total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The at least one web page includes a target web page. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage.
The receiving module is further used for receiving at least one resource acquisition request from the electronic equipment; each resource obtaining request in the at least one resource obtaining request is used for requesting to obtain a static resource referenced by the target webpage. And the request processing module is also used for responding to each resource acquisition request and acquiring a static resource referenced by the target webpage. And the sending module is also used for sending the static resource quoted by the target webpage to the electronic equipment. Whether the at least one static resource is successfully transmitted to the electronic equipment is used for representing the downloading progress of the at least one static resource.
In one possible embodiment, the output content is at least one resource directory corresponding to at least one web page. The apparatus also includes a resource determination module. A resource determination module to: before receiving an acquisition request from the electronic equipment, acquiring a development document of a webpage project; determining at least one resource directory; compiling a development document, and correspondingly storing compiled indication information of static resources quoted by at least one compiled webpage into at least one resource directory according to the corresponding relation between the at least one webpage and the indication information quoted by the at least one webpage before compiling to obtain at least one updated resource directory; and obtaining the total corresponding relation according to the updated at least one resource directory.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage. The at least one resource directory is in one-to-one correspondence with the at least one web page.
In another possible implementation, the resource determining module is specifically configured to: traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain a compiled name of the static resource quoted by each webpage; and generating the compiled URL of the static resource quoted by each webpage according to the preset URL prefix and the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between at least one webpage and the compiled URL of the static resource quoted by at least one webpage is the total corresponding relation.
The preset URL prefix refers to an address of a static resource which is stored in the network and is referred by at least one webpage.
In another possible implementation, the resource determining module is specifically configured to: and traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between the compiled names of the static resource quoted by the at least one webpage and the at least one webpage is the total corresponding relation.
In another possible implementation, the output content is a compiled name of the static resource. A resource determination module to: before the acquisition request from the electronic equipment is received, acquiring a development document of a webpage project; compiling a development document, and marking the compiled name of the static resource to be compiled with the corresponding webpage identifier according to the corresponding relationship between the at least one webpage and the pre-compiled indication information of the static resource quoted by the at least one webpage; and obtaining the total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage.
In another possible implementation manner, the request processing module is specifically configured to: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage into a preset document; and acquiring the URL of the preset document, and determining the URL of the preset document as target indication information.
The URL of the preset document represents an address where the preset document is stored.
In another possible implementation manner, the request processing module is specifically configured to: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; determining a compiled document of a target webpage; compiling the compiling document of the target webpage is obtained by compiling the development document; and storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage to an entry position of a hypertext markup language document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determining the modified compiled document of the target webpage as the target indication information.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a web resource acquiring apparatus applied to an electronic device, the apparatus including: the device comprises a sending module, a receiving module, a resource obtaining module and an information prompting module.
The sending module is used for responding to the access operation of the target webpage and sending an acquisition request to the server; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage.
And the receiving module is used for receiving the target indication information from the server. The target indication information is used for representing compiled indication information of at least one static resource quoted by the target webpage; the target indication information is obtained from the overall correspondence. The total correspondence is used for representing compiled indication information of static resources respectively quoted by at least one webpage in the webpage items. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The target web page belongs to at least one web page.
The resource acquisition module is used for acquiring the URL of at least one static resource quoted by the target webpage according to the target indication information; loading the URL of at least one static resource to send at least one resource acquisition request to a server; the resource obtaining request is used for requesting to obtain a corresponding static resource.
And the information prompt module is used for determining the processing state of at least one resource acquisition request and determining the downloading progress of at least one static resource according to the processing state of at least one resource acquisition request. The processing state of the resource acquisition request is the successful downloading or the failed downloading of the corresponding static resource.
In a possible implementation, the target indication information is a URL of a preset document, and the preset document is used for storing compiled indication information of at least one static resource referenced by the target webpage. The resource obtaining module is specifically configured to: loading a URL of a preset document to send a document acquisition request to a server; the document acquisition request is used for requesting to acquire a preset document; receiving a preset document from a server; and acquiring the URL of the at least one static resource quoted by the target webpage according to the compiled indication information of the at least one static resource quoted by the target webpage.
In another possible implementation, the target indication information is a modified compiled document of the target web page; compiled indication information of at least one static resource referenced by the target webpage is stored at an entry position of the hypertext markup language document in the modified compiled document of the target webpage. The resource obtaining module is specifically configured to: and acquiring the URL of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the revised compiled document of the target webpage.
In another possible embodiment, the compiled indication information of the at least one static resource referred by the target webpage is a compiled name of the at least one static resource or a URL of the at least one static resource. The resource obtaining module is specifically configured to: under the condition that the compiled indication information of the at least one static resource quoted by the target webpage is the compiled name of the at least one static resource, generating a compiled URL of the at least one static resource quoted by the target webpage according to a preset URL prefix and the compiled name of the at least one static resource quoted by the target webpage; in a case that the compiled indication information of the at least one static resource referred to by the target webpage is a URL of the at least one static resource, it is determined that the compiled indication information of the at least one static resource referred to by the target webpage is the URL of the at least one static resource referred to by the target webpage.
The preset URL prefix refers to an address of at least one static resource referenced by a target webpage stored on a network.
In another possible implementation, the information prompting module is further configured to count the number of processing completions according to the processing state of the at least one resource acquisition request after the URL of the at least one static resource is loaded to send the at least one resource acquisition request to the server; the processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading; and dividing the processing completion number by the total number of the at least one resource acquisition request to obtain a processing completion ratio.
The device also includes a display module. And the display module is used for displaying the processing completion ratio or the prompt information for representing the processing completion ratio.
In another possible implementation, the receiving module is further configured to receive a compiled document of a target webpage from the server after the obtaining request is sent to the server; and after the URL of the at least one static resource is loaded so as to send at least one resource acquisition request to the server, receiving the static resource referenced by the target webpage from the server. The apparatus also includes a page generation module. And the page generating module is used for generating the page of the target webpage according to the compiled document of the target webpage and the obtained static resource quoted by the target webpage. And the display module is also used for displaying the page of the target webpage.
In another possible implementation manner, the receiving module is further configured to receive, from the server, the static resource referenced by the target webpage after the URL of the at least one static resource is loaded to send the at least one resource obtaining request to the server. And the page generation module is used for generating the page of the target webpage according to the modified compiled document of the target webpage and the acquired static resource quoted by the target webpage. And the display module is also used for displaying the page of the target webpage.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a web resource acquisition system, including a server and an electronic device; wherein the server is configured to execute the web resource obtaining method according to the first aspect and any possible implementation manner thereof; the electronic device is configured to execute the web page resource obtaining method according to the second aspect and any possible implementation manner thereof.
According to a sixth aspect of embodiments of the present disclosure, there is provided a server including: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to cause the server to perform the web page resource obtaining method as in the first aspect and any one of its possible embodiments.
According to a seventh aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to cause the electronic device to execute the web page resource obtaining method according to the second aspect and any possible implementation manner thereof.
According to an eighth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer instructions, which, when run on a server, cause the server to execute the method for acquiring web page resources according to the first aspect and any one of its possible implementations.
According to a ninth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer instructions, which, when run on an electronic device, cause the electronic device to execute the web page resource acquisition method of the second aspect and any one of its possible implementations.
According to a tenth aspect of embodiments of the present disclosure, there is provided a computer program product including one or more instructions executable on a server, such that the server performs the method for acquiring web page resources according to the first aspect and any possible implementation manner thereof.
According to an eleventh aspect of embodiments of the present disclosure, there is provided a computer program product including one or more instructions executable on an electronic device to cause the electronic device to perform a method for acquiring web page resources as in the second aspect and any one of its possible implementations.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: and the server receives an acquisition request of the electronic equipment for the target webpage, reads the total corresponding relation and obtains target indication information corresponding to the target webpage in the acquisition request. The general correspondence is obtained by adjusting output contents (such as a resource directory and a name after static resource compilation) when compiling a development document of a web page project. The total correspondence represents compiled indication information of the static resource quoted by each webpage, and the server can determine the compiled indication information of the at least one static resource quoted by the target webpage from the compiled indication information of the static resource quoted by the at least one webpage and then obtain the target indication information. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage. The compiled indication information of at least one static resource referred by the target webpage records all the static resources referred by the target webpage, and does not include the static resources referred by other webpages except the target webpage. Therefore, the compiled indication information of the at least one static resource referenced by the target webpage accurately records the static resource referenced by the target webpage. Because the compiled indication information of the at least one static resource referred by the target webpage accurately records the static resource referred by the target webpage, and the target indication information is used for representing the compiled indication information of the at least one static resource referred by the target webpage, the target indication information can also accurately indicate the static resource referred by the target webpage. Furthermore, the static resources quoted by the target webpage can be accurately acquired according to the target indication information, and the problem of omission or redundancy does not exist.
Further, since the target indication information accurately records the static resources referred by the target webpage, the electronic device may request the server to acquire only all the static resources referred by the target webpage according to the target indication information. Therefore, the server receives at least one resource acquisition request sent by the electronic device, and the resource acquisition request is only used for requesting to acquire at least one static resource referenced by the target webpage. Then, the server responds to each resource acquisition request and sends one static resource referenced by the target webpage to the electronic equipment. And the at least one static resource sent to the electronic equipment is the static resource referred by the target webpage. Furthermore, the downloading progress of the static resource quoted by the target webpage can be accurately represented according to whether the downloading progress of the at least one static resource determined by the at least one static resource is successfully sent to the electronic equipment.
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 present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a schematic diagram illustrating an implementation environment involved in a method for acquiring web page resources according to an exemplary embodiment;
FIG. 2 is a flowchart illustrating a first method for acquiring web page resources applied to a server according to an exemplary embodiment;
FIG. 3 is a flowchart illustrating a web page resource acquisition method applied to a server according to an exemplary embodiment;
FIG. 4 is a flowchart illustrating a web resource acquisition method applied to a server according to an exemplary embodiment;
FIG. 5 is a flowchart illustrating a fourth method for acquiring web page resources applied to a server according to an exemplary embodiment;
FIG. 6 is a flowchart illustration of a web resource acquisition method applied to a server in accordance with an exemplary embodiment;
FIG. 7 is a flowchart illustrating a sixth method for obtaining web page resources applied to a server, in accordance with an illustrative embodiment;
FIG. 8 is a seventh flowchart illustrating a method for obtaining web page resources applied to a server in accordance with an illustrative embodiment;
FIG. 9 is a flowchart illustrating a first method for acquiring web page resources applied to an electronic device, according to an example embodiment;
FIG. 10 is a flowchart illustrating a first web resource acquisition method applied to a web resource acquisition system according to an exemplary embodiment;
FIG. 11 is a flowchart illustrating a web page resource obtaining method applied to an electronic device according to an exemplary embodiment;
FIG. 12 is a flowchart illustrating a third method for acquiring web page resources applied to an electronic device, according to an example embodiment;
FIG. 13 is a flowchart illustrating a web resource acquisition method applied to a web resource acquisition system according to an exemplary embodiment;
fig. 14 is a schematic structural diagram illustrating a web resource acquiring apparatus applied to a server according to an exemplary embodiment;
fig. 15 is a schematic structural diagram illustrating a web resource acquiring apparatus applied to an electronic device according to an exemplary embodiment;
FIG. 16 is a schematic diagram illustrating the structure of a server in accordance with an exemplary embodiment;
fig. 17 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in 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 above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The embodiment of the disclosure provides a method for acquiring webpage resources, and terms related in the embodiment of the disclosure are introduced as follows:
and (4) webpage items: may refer to a World Wide Web application or website and may include one or more Web pages. Among them, the Web application is an application that can be accessed through the Web.
Single page web application (SPA): an application that has only one Web page is a Web application that loads a single HTML page and dynamically updates the Web page as the user interacts with the application.
HTML: refers to a standard markup language for creating web pages. The HTML document is run on an application program (e.g., a browser) for browsing web pages.
Cascading Style Sheets (CSS): is a computer Language used to represent styles such as HTML documents or Extensible Markup Language (XML) documents. The CSS can not only statically modify the web page, but also dynamically format elements of the web page in coordination with various scripting languages. The CSS can accurately control the typesetting of element positions in the webpage at a pixel level, supports almost all font and font styles and has the capability of editing webpage objects and model styles.
Scripting language (Javascript, JS): also known as a build language, or dynamic language, is a programming language used to control software applications, and the script speech is usually stored as text and is interpreted or compiled only when called.
webpack: the webpage code compiling tool has the functions of collecting static resources depended on or quoted by each webpage in the webpage project according to the development documents of the webpage project and outputting the compiled documents in the result of compiling the development documents. Wherein the development document may include source code for the web page item.
Static resources: refers to an electronic file that can be accessed multiple times without the binary content changing, e.g., pictures, font packs, video, etc.
Please refer to fig. 1, which illustrates an implementation environment diagram related to a method for acquiring web page resources according to an embodiment of the present disclosure. As shown in fig. 1, the implementation environment may include a server 101 and a plurality of electronic devices 102, the plurality of electronic devices 102 being connected to the server 101 through a wired network or a wireless network. The plurality of electronic devices 102 may include an electronic device 1021, an electronic device 1022, and the like. The server 101 may provide data support for a certain webpage item. A plurality of electronic devices 102 may be installed with applications (e.g., browsers or other clients) for accessing and browsing web pages.
Taking the electronic device 1021 as an example, the electronic device 1021 may receive an access operation of a user to a certain webpage (which may be referred to as a target webpage) in a webpage project through the application; in response to the access operation, an acquisition request is sent to the server 101 corresponding to the web page item. The obtaining request may be used to request the server 101 to obtain the web page information of the target web page. The web page information of the target web page may include an HTML document, a CSS document, a JS document, and the like.
Then, the electronic device 1021 receives the web page information of the target web page from the server 101. Acquiring static resources in the target webpage by utilizing the webpage information of the target webpage; and generating and displaying the page of the target webpage by utilizing the webpage information of the target webpage and the acquired static resources.
It should be noted that the number of electronic devices and servers in fig. 1 is merely illustrative. There may be any number of electronic devices and servers, depending on the actual needs.
Currently, an application (e.g., a browser) in an electronic device for accessing and browsing a web page receives web page information of a certain web page (which may be referred to as a target web page) from a server in response to an access operation of a user to the certain web page. Since each target web page typically includes a plurality of static resources, the web page information of the target web page includes URLs of the plurality of static resources in the target web page. The URL of each static resource is used to indicate the address on the internet where the static resource is stored. Then, the browser in the electronic device may use the URL of the static resource in the web page information of the target web page to obtain all the static resources in the target web page in advance.
When the browser in the electronic device displays the page of the target web page, although some static resources are not displayed temporarily, the browser requests to acquire the static resources from the server when a certain static resource needs to be displayed, and a failure of requesting the static resources that need to be displayed due to poor network may occur. Therefore, in order to avoid the problem of failure of the static resource request that needs to be displayed, the electronic device may first obtain the static resource list of the target web page, and then request the server to obtain all the static resources in the static resource list in advance (i.e., download the static resources in the static resource list). Furthermore, the electronic device may generate and display a page of the target webpage by using the acquired static resource (which may also be referred to as a downloaded static resource). The list of static resources includes the URLs of all static resources referenced by the target web page.
On one hand, the electronic device may adopt the first scheme to obtain the static resource list of the target webpage, which specifically includes: the electronic device traverses a specific tag in a HyperText Markup Language (HTML) document of the target webpage to obtain a static resource list of the target webpage. Wherein the specific tag can be used to characterize various static resources, such as < img > for a tag representing a picture, < audio > for a tag representing audio, < video >, etc.
However, the static resource list obtained by traversing in this way only includes the static resources in the HTML document of the target web page, and does not include the static resources in the CSS document of the target web page; therefore, the static resource list obtained by the first solution is overlooked, that is, the static resource list cannot include URLs of all static resources referenced by the target webpage. And, since CSS documents do not have specific tags for characterizing various static resources; therefore, the process of acquiring the static resource in the CSS document by the electronic device is complex and time-consuming.
Secondly, if the target webpage is a single-page application SPA, the page of the target webpage displayed by the electronic equipment is generated in response to the access operation of the user to the page, the URL of the static resource referred by other pages of the SPA is not contained in the HTML document of the target webpage, and the URL of the static resource referred by other pages is added to the HTML document of the target webpage in response to the access operation of the user to other pages. Therefore, for the SPA, the static resource list obtained by the above-mentioned scheme one also has a divulgence, i.e., the static resource list cannot include URLs of static resources referenced by all pages of the SPA.
In summary, since the static resource list obtained by the first solution cannot include all the static resources referred by the target web page, the user may need to wait to download other static resources referred by the target web page except the static resources in the static resource list, which results in poor browsing experience of the user on the target web page.
On the other hand, the electronic device may further adopt a second scheme to obtain the static resource list of the target webpage, which specifically includes: because the static resources quoted by each webpage in the webpage project are recorded in a development catalog in the development process of the webpage project; therefore, the device at the development end can acquire the catalog of the target webpage from the development catalog, and the catalog of the target webpage is used as a static resource list of the target webpage; and then the static resource list of the target webpage is sent to the electronic equipment. And then, the electronic equipment requests the server to acquire the static resource quoted by the target webpage according to the static resource list of the target webpage. The electronic equipment can request to acquire the static resource quoted by the target webpage from the server according to the compiled document of the webpage project. The compiled document is obtained by compiling the development document of the webpage project, the static resource name compiled in the compiled document and the static resource name compiled in the development catalog may be different, and the static resource name compiled in the static resource list of the target webpage and the static resource name compiled in the compiled document may also be different according to the development target. Furthermore, the electronic device cannot request to acquire the static resource in the target webpage by using the development catalog to acquire the static resource list of the target webpage.
In order to ensure that the static resources quoted after compiling are all the latest, the condition that the static resources before updating are displayed in the same-name cache in the client browser due to the fact that the names of the static resources are not updated after the development documents (such as the content of the static resources) in the server are updated is avoided. Therefore, it is common practice in current web page development to add a hash value to the name of the static resource during compiling, so as to obtain the name of the static resource with the hash value. For example, one static resource in the development document is image. jpg, and the compiled name of the static resource is image. hash01. jpg; wherein hash01 is a hash value that is incremented upon compilation. The static resource name obtained by compiling in the compiled document is different from the static resource name in the development catalog, so that the static resource list of the target webpage obtained by utilizing the development catalog cannot be used for requesting to obtain the static resource in the target webpage.
Secondly, because the static resources referred by all the web pages included in the web page project are all saved in the same compiling directory in the compiling document after compiling, the compiling directory records the static resources referred by all the web pages in the web page project, for example, if the web page a refers to x.jpg and the web page B refers to y.jpg, the compiling directory includes x.jpg and y.jpg. Then, the static resource list obtained by using the compiled directory also includes the static resources referenced by all the web pages, that is, the static resource list obtained by using the compiled directory includes the static resources not referenced by the target web page, that is, there is redundancy. And then, other static resources which do not belong to the static resources quoted by the target webpage are obtained by utilizing the static resource list request, namely redundancy exists, unnecessary time consumption is increased, and the browsing experience of the user on the target webpage is reduced.
It should be noted that, because the electronic device needs to download the static resource in the static resource list first, and then generate the page of the target webpage by using the downloaded static resource. Therefore, in the process of downloading the static resources in the static resource list, the electronic device cannot display the page of the target webpage and can display a white screen or an infinite loop loading animation. Displaying a white screen or endless loop of loading animation for a longer time increases the probability that the user will terminate accessing the target web page. Therefore, the electronic device can also obtain the downloading progress of the static resources in the static resource list in real time, and display prompt information (such as characters and pictures) representing the downloading progress. The prompt information enables the user to visually know the downloading progress of the static resource, and the condition that the user stops accessing the target webpage due to blind waiting is reduced. However, the static resource list obtained by the above scheme has the problem of omission or redundancy, so that the obtained prompt information representing the downloading progress is also inaccurate.
Aiming at the problem that the static resource of the target webpage requested to be acquired by the scheme is missing or redundant, the embodiment of the disclosure provides a method for acquiring the resource of the target webpage, which can accurately acquire the static resource quoted by the target webpage, does not have the problem of missing or redundancy of the acquired static resource, and can also accurately determine the downloading progress of the static resource quoted by the target webpage.
It should be noted that the web resource obtaining method provided by the embodiment of the present disclosure may be applied to the electronic device (e.g., the electronic device 1021 or the electronic device 1022) installed with the application (e.g., the browser) for accessing and browsing the web page, the server (e.g., the server 101) or the web resource obtaining system. The webpage resource acquisition system comprises the electronic equipment and the server. The execution main body of the webpage resource obtaining method provided by the embodiment of the disclosure may be a webpage resource obtaining device, and the webpage resource obtaining device may be the electronic device/the server/the webpage resource obtaining system. The webpage resource acquisition device can also be an application program providing a webpage resource acquisition function; or, the web resource obtaining device may also be a Central Processing Unit (CPU) of the electronic device/the server/the web resource obtaining system; alternatively, the web resource acquiring apparatus may also be a control module for executing web resource acquisition in the electronic device/the server/the web resource acquiring system.
For example, the electronic device in the embodiment of the present disclosure may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, or the like, and the embodiment of the present disclosure does not particularly limit the specific form of the electronic device.
Referring to fig. 2, a flowchart of a method for acquiring web page resources according to an exemplary embodiment, where the method is applied to the server, may include S201-S205.
S201, the server receives an acquisition request from the electronic equipment.
The obtaining request is used for requesting to obtain compiled indication information of the static resource quoted by the target webpage. For example, the fetch request may include an identification of the target web page. The server may obtain compiled indication information of the referenced static resource in response to the obtaining request.
In the embodiment of the present disclosure, the target webpage may be one of certain webpage items, and the webpage items include at least one webpage. The server may be used to provide data support for the web page project.
The web page items can include at least one web page and other web pages different from the at least one web page. At least one web page may be a web page that has a need to download static resources, e.g., at least one web page is a web page that has a high frequency of user access.
In the embodiment of the disclosure, the web page item may include at least one single-page application SPA, the at least one web page is a web page of at least one SPA, and the static resources referred to by the web page of the SPA include static resources referred to by all pages of the SPA.
S202, the server responds to the acquisition request, reads the total corresponding relation and obtains target indication information corresponding to the target webpage.
The server may acquire the overall correspondence in advance. And then, the electronic equipment receives and responds to the acquisition request, reads the total corresponding relation and obtains target indication information corresponding to the target webpage.
The total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project. The overall correspondence is obtained by adjusting the output content (e.g., resource catalog, compiled name of static resource) when compiling the development document of the web project. The at least one web page includes a target web page. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage.
For example, the overall correspondence may be a correspondence between at least one web page in the web page project and compiled indication information of static resources referenced by the at least one web page.
In this embodiment of the present disclosure, the compiled indication information of the static resource in the total corresponding relationship may be a compiled name of the static resource or a URL of the static resource.
In this embodiment of the present disclosure, the total correspondence may include an identifier of the at least one webpage, where the identifier of the at least one webpage includes an identifier of the target webpage. The server may obtain a corresponding relationship (which may be referred to as a target corresponding relationship) including an identifier of the target web page from the total corresponding relationship; and determining target indication information according to the target corresponding relation.
Wherein, the target corresponding relation comprises: compiled indication of at least one static resource referenced by the target web page. The compiled indication information of the at least one static resource referenced by the target webpage may be a compiled name of the at least one static resource or a URL of the at least one static resource.
In the embodiment of the present disclosure, the target indication information may be a target correspondence, compiled indication information of at least one static resource referred by the target webpage, a URL of a preset document, or a modified compiled document of the target webpage. The preset document is used for storing a target corresponding relation or compiled indication information of at least one static resource quoted by a target webpage in the target corresponding relation; the URL of the preset document indicates an address where the preset document is stored. The modified compiled document of the target webpage is obtained by storing a target corresponding relation (or compiled indication information of at least one static resource quoted by the target webpage) at the entrance position of an HTML document in the compiled document of the target webpage; the compiled document of the target webpage is obtained by compiling the development document of the target webpage.
In the embodiment of the present disclosure, when the target indication information is the URL of the preset document, after obtaining the target corresponding relationship from the total corresponding relationship, the server may store the target corresponding relationship, or compiled indication information of at least one static resource referred by a target webpage in the target corresponding relationship, in the preset document; and then acquiring the URL of the preset document, and determining that the URL of the preset document is the target indication information.
Or, the server may obtain the compiled document of the target webpage first after obtaining the target corresponding relationship from the total corresponding relationship, in the case that the target indication information is the modified compiled document of the target webpage; and then storing the target corresponding relation or the compiled indication information of at least one static resource quoted by the target webpage in the target corresponding relation to the entry position of the HTML document in the compiled document of the target webpage to obtain the modified compiled document of the target webpage, and determining that the modified compiled document of the target webpage is the target indication information.
Illustratively, the server may add the target correspondence, or the compiled indication information of the at least one static resource referenced by the target webpage in the target correspondence, to the entry position of the HTML document in the compiled document of the target webpage by using the < script > tag, so as to obtain a modified compiled document of the target webpage. Where the < script > tag is used to define a client-side script, such as JavaScript.
In the embodiment of the present disclosure, the server may obtain a development document of the web page project before S202. Then, the server compiles the development document, and obtains a total corresponding relationship according to the corresponding relationship (which may be referred to as a corresponding relationship before compilation) between the at least one webpage and the pre-compilation indication information of the static resource referred by the at least one webpage.
Wherein the development document comprises the corresponding relation before compiling. The development document of the web page project can refer to a source code of the web page project, and the source code of the web page project declares the reference of at least one web page to static resources, namely the corresponding relation before compiling.
For example, the pre-compilation correspondence may be a correspondence between an identification of the at least one web page and pre-compilation indication information of a static resource referenced by the at least one web page.
S203, the server sends the target indication information to the electronic equipment.
The server sends the target indication information to the electronic device. The target indication information can be used for triggering the electronic device to acquire the static resource indicated by the target indication information, namely at least one static resource referred by the target webpage, according to the target indication information.
In this disclosure, in a case that the target indication information is the target corresponding relationship or the URL of the preset document, the server may further obtain a compiled document of the target webpage, and then may send the compiled document of the target webpage to the electronic device in addition to sending the target indication information to the electronic device.
S204, the server receives at least one resource acquisition request from the electronic equipment.
Each resource obtaining request in the at least one resource obtaining request is used for requesting to obtain a static resource referenced by the target webpage.
After the electronic device receives the target indication information, if the compiled indication information of the at least one static resource referred by the target webpage is a compiled name of the at least one static resource referred by the target webpage, the electronic device may generate a URL of the at least one static resource referred by the target webpage according to the compiled name of the at least one static resource referred by the target webpage. Then, the electronic equipment loads the URL of the at least one static resource referenced by the target webpage so as to send at least one resource acquisition request to the server.
Or, if the compiled indication information of the at least one static resource referred by the target webpage is the URL of the at least one static resource referred by the target webpage, the electronic device directly loads the URL of the at least one static resource referred by the target webpage to send the at least one resource acquisition request to the server.
S205, the server responds to each resource acquisition request, and acquires and sends a static resource referenced by the target webpage to the electronic equipment.
And whether the at least one static resource is successfully transmitted to the electronic equipment is used for representing the downloading progress of the at least one static resource. For example, the electronic device may determine a download progress of the at least one static resource based on whether the at least one static resource was successfully transmitted to the electronic device.
It can be understood that, if the server receives an acquisition request of the electronic device for the target webpage, the server reads the total corresponding relationship to obtain the target indication information corresponding to the target webpage in the acquisition request. The total corresponding relation is obtained by adjusting output contents when compiling the development documents of the webpage projects. The total correspondence represents compiled indication information of the static resource quoted by each webpage, and the server can determine the compiled indication information of the at least one static resource quoted by the target webpage from the compiled indication information of the static resource quoted by the at least one webpage and then obtain the target indication information. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage. The compiled indication information of at least one static resource referred by the target webpage records all the static resources referred by the target webpage, and does not include the static resources referred by other webpages except the target webpage. Therefore, the compiled indication information of the at least one static resource referenced by the target webpage accurately records the static resource referenced by the target webpage. Because the compiled indication information of the at least one static resource referred by the target webpage accurately records the static resource referred by the target webpage, and the target indication information is used for representing the compiled indication information of the at least one static resource referred by the target webpage, the target indication information can also accurately indicate the static resource referred by the target webpage.
Further, since the target indication information accurately records the static resources referred by the target webpage, the electronic device may request the server to acquire only all the static resources referred by the target webpage according to the target indication information. Therefore, the server receives at least one resource acquisition request sent by the electronic device, and the resource acquisition request is only used for requesting to acquire at least one static resource referenced by the target webpage. Then, the server responds to each resource acquisition request and sends one static resource referenced by the target webpage to the electronic equipment. And the at least one static resource sent to the electronic equipment is the static resource referred by the target webpage. Furthermore, the downloading progress of the static resource quoted by the target webpage can be accurately represented according to whether the downloading progress of the at least one static resource determined by the at least one static resource is successfully sent to the electronic equipment.
In the embodiment of the present disclosure, in order to obtain the above total correspondence, that is, the correspondence between the compiled indication information of the static resource referred by the at least one web page and the at least one web page, the server may determine that the static resource referred by different web pages is output to different resource directories before compiling the development document of the web page project, that is, the different resource directories store the compiled indication information of the static resource referred by different web pages. Then, the server can determine the corresponding relation between the at least one webpage and the compiled indication information of the static resource referred by the at least one webpage according to all the resource directories. As shown in fig. 3, in the case that the compiled indication information of the static resource referred by the at least one web page in the overall correspondence includes a compiled name of the static resource referred by the at least one web page, the web page resource obtaining method may include, before S202, S301 to S304.
S301, a server acquires a development document of a webpage project; the development document includes a correspondence between at least one web page and pre-compilation indication information of static resources referenced by the at least one web page.
For details of the development document of the webpage item in S301, reference may be made to the above-mentioned detailed description of the development document of the webpage item in S202, and details of the development document of the webpage item are not repeated here in the embodiment of the present disclosure.
S302, the server determines at least one resource directory corresponding to at least one webpage.
The server determines at least one resource directory for at least one webpage, wherein the at least one resource directory is used for storing compiled indication information of static resources referenced by the at least one webpage. Wherein, at least one resource directory corresponds to at least one webpage one by one.
The server may mark, for each resource directory in the at least one resource directory, an identifier of a corresponding web page, for example, a name of one web page is the same as a name of a corresponding resource directory.
Alternatively, the server may establish a correspondence between the at least one resource directory and the at least one web page, for example, a correspondence between an identification of the at least one resource directory and an identification of the at least one web page. The identifier of a web page and the identifier of a corresponding resource directory may be different.
S303, the server compiles the development document, and correspondingly stores the compiled name of the static resource quoted by the compiled at least one webpage into at least one resource directory according to the corresponding relation before compiling to obtain at least one updated resource directory.
The server compiles the development document to obtain a compiled document of the webpage project, and can also obtain at least one updated resource catalog according to the corresponding relation before compiling. Each updated resource directory stores a compiled name of a static resource referenced by a corresponding web page.
S304, the server obtains the total corresponding relation according to the updated at least one resource directory.
The server may obtain the total correspondence according to the updated at least one resource directory and the at least one resource directory corresponding to the at least one web page.
In an embodiment of the present disclosure, the total correspondence may include a compiled name of a static resource referenced by each of the at least one web page. In this case, the server may traverse, for each web page in the at least one web page, the resource directory corresponding to each web page in the updated at least one resource directory to obtain a compiled name of the static resource referred to by each web page, and determine that a correspondence between the compiled names of the static resource referred to by the at least one web page and the at least one web page is a total correspondence.
Wherein the total correspondence may include an identification of at least one web page.
And if the resource directory corresponding to each webpage in at least one webpage can be marked with the identifier of the webpage, the updated resource directory is also marked with the identifier of the webpage. Furthermore, the server may determine, according to the identifier of the web page marked by each updated at least one resource directory, an updated resource directory corresponding to each web page.
Or, the server may determine the updated resource directory corresponding to each web page according to the correspondence between the at least one resource directory and the at least one web page. The corresponding relationship between the at least one resource directory and the at least one webpage may be the same as the updated corresponding relationship between the at least one resource directory and the at least one webpage.
For example, one resource directory corresponding to the web page a may be the resource directory a named with the identifier a of the web page a, and the updated resource directory a includes x1.hash0.jpg and x2. hash0.jpg. Further, the server may determine that the compiled names of the static resources referenced by web page A include x1.hash0.jpg and x2.hash0. jpg.
Exemplarily, the compiling tool webpack has the following functions: compiling the development document, determining the corresponding relation between the identification of at least one webpage and the indication information before compiling of the static resource quoted by at least one webpage (namely the corresponding relation before compiling), compiling the static resource quoted by at least one webpage and outputting the static resource to the same catalogue. Therefore, the server can input the development document of the webpage item to the compiling tool webpack and determine that the catalog of the static resource compiled and output by the compiling tool webpack is at least one resource catalog corresponding to at least one webpage. Then, the server compiles the development document through a compiling tool webpack to obtain a compiled document of the webpage project, and can also obtain at least one updated resource directory according to the corresponding relation before compiling.
In this embodiment of the present disclosure, when at least one webpage is a webpage of an SPA, the total correspondence includes a correspondence between an identifier of the webpage of the SPA and compiled indication information of a static resource referred by the webpage of the SPA. Wherein the at least one web page may include web pages of one or more SPAs. The static resources referenced by the web page of each SPA include the static resources referenced by all pages of that SPA.
In the embodiment of the present disclosure, the server determines that the static resources referred by different webpages in the compiling process are output to different resource directories, and the updated different resource directories store the compiled names of the static resources referred by different webpages. Then, the server can also convert the compiled name of the static resource referred by each webpage and the address storing the static resource referred by each webpage to obtain the URL of the static resource referred by each webpage. And further determining the corresponding relation between the identification of each webpage and the URL of the static resource quoted by each webpage. As shown in fig. 4, in the case that the compiled indication information of the static resource referred by the at least one web page in the overall correspondence includes the URL of the static resource referred by the at least one web page, the web page resource obtaining method may include, before S202, S301 to S303 and S305 to S306.
S305, the server traverses the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain the compiled name of the static resource quoted by each webpage.
In this embodiment of the present disclosure, the server may determine the updated resource directory corresponding to each web page first. Then, the server traverses the updated resource directory corresponding to each webpage to obtain the compiled name of the static resource referred by each webpage.
S306, the server generates the compiled URL of the static resource quoted by each webpage according to the preset URL prefix and the compiled name of the static resource quoted by each webpage, and determines that the corresponding relation between at least one webpage and the compiled URL of the static resource quoted by at least one webpage is the total corresponding relation.
The preset URL prefix may refer to an address where a static resource referred to by at least one webpage is stored on the network. The compiled indication information of the static resource referred by the at least one webpage in the total corresponding relationship comprises a URL of the static resource referred by the at least one webpage.
Illustratively, the at least one web page may include web page A and web page B, and the preset URL prefix corresponding to the at least one web page may be http:// static. The compiled names of the static resources referenced by the web page a include x1.hash0.jpg and x2.hash0.jpg, and the compiled names of the static resources referenced by the web page B include y.hash0.jpg. Further, the electronic device may determine the overall correspondence relationship including: http:// static. com/image/x1.hash0.jpg and http:// static. com/image/x2.hash0.jpg corresponding to the identity of web page a, http:// static. com/image/y. hash0.jpg corresponding to the identity of web page B.
It will be appreciated that the server determines that the static resources referenced by different web pages are exported to different resource directories during compilation. Therefore, when the server obtains the total corresponding relationship, the compiled indication information of the static resource referred by at least one webpage can be determined only by respectively traversing the updated at least one resource directory corresponding to the at least one webpage. The updated at least one resource directory corresponding to the at least one webpage does not include static resources referenced by other webpages except the at least one webpage, so that the problem of time consumption increase caused by the server traversing the static resources referenced by other webpages except the at least one webpage in the webpage project is avoided.
In the embodiment of the present disclosure, the server may output the static resources referred by different webpages to different resource directories, but may also output the static resources referred by different webpages to the same total resource directory without using different resource directories, i.e., the compiled names of the static resources referred by different webpages are output to the same total resource directory. Then, the server can determine the total corresponding relationship according to the total resource catalog and the corresponding relationship before compiling. As shown in fig. 5, in the case that the compiled indication information of the static resource referred by the at least one web page in the overall correspondence includes a compiled name of the static resource referred by the at least one web page, the web page resource obtaining method may include, before S202, S301 and S401-S402.
S401, the server compiles the development document, and marks the webpage corresponding to the compiled name of the static resource obtained by compiling according to the corresponding relation before compiling.
And normally compiling the development document of the webpage project by the server to obtain the compiled name of the static resource quoted by at least one webpage stored in the same total resource directory. And in the compiling process, the server also determines and marks the identification of the corresponding webpage for the compiled name of the static resource obtained by compiling according to the corresponding relation before compiling.
S402, the server obtains a total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained through compiling.
The server may obtain a correspondence, i.e., a total correspondence, between the identifier of the at least one web page and the compiled name of the static resource, according to the identifier of the web page marked by the compiled name of the static resource.
In the embodiment of the present disclosure, in addition to determining that the correspondence between the identifier of the at least one webpage and the compiled name of the static resource is the total correspondence, the server may convert the compiled name of the static resource corresponding to the identifier of the at least one webpage and the address storing the static resource referred by the at least one webpage to obtain the URL of the static resource referred by the at least one webpage. The server then determines that the identity of the at least one web page is in an overall correspondence with the URL of the static resource referenced by the at least one web page. Fig. 6 is a flowchart of a method for acquiring web page resources, which is applied to the server. In the case that the compiled indication information of the static resource referred by the at least one web page in the overall correspondence includes a URL of the static resource referred by the at least one web page, S202 in the method may include S401 and S403.
And S403, the server obtains the total corresponding relation according to the preset URL prefix and the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
And compiling the indication information of the static resource quoted by the at least one webpage in the total corresponding relation, wherein the compiled indication information of the static resource quoted by the at least one webpage comprises the URL of the static resource quoted by the at least one webpage.
The server may obtain a correspondence between the identifier of the at least one web page and the compiled name of the static resource according to the identifier of the web page marked by the compiled name of the static resource. Then, combining the preset URL prefix and the compiled name of the static resource to obtain the URL of the static resource, and determining the corresponding relation between the identifier of at least one webpage and the URL of the static resource quoted by the at least one webpage, namely the total corresponding relation.
It can be understood that, in addition to setting different directories to store the compiled names of the static resources referred by different webpages, the server may also determine and mark the identifiers of the corresponding webpages for the compiled names of the static resources according to the correspondence before compiling, and the embodiment of the present disclosure does not limit the implementation manner of separating the compiled names of the static resources referred by each webpage by the server.
In this embodiment, after obtaining the target corresponding relationship from the total corresponding relationship, the server may store the target corresponding relationship or compiled indication information of at least one static resource referenced by the target webpage in the target corresponding relationship in a preset document. Then, the server acquires the URL of the preset document and takes the URL of the preset document as target indication information corresponding to the target webpage. The URL of the preset document is an address where the preset document is stored, and the target corresponding relationship in the preset document can be acquired through the URL of the preset document. Taking the total correspondence shown in fig. 3 and the target correspondence stored in the preset document as an example, as shown in fig. 7, the method is applied to the server. The method for acquiring web page resources in the method may include, before S202, S301 to S304, and S202 in the method may include S501 to S503.
S501, the server acquires a target corresponding relation from the total corresponding relation; the target correspondence is a correspondence that includes an identification of the target web page.
The server may obtain, from the total correspondence, a correspondence between the identifier of the target webpage and the compiled name of the at least one static resource referred by the target webpage, that is, a target correspondence. The target correspondence includes a compiled name of at least one static resource referenced by the target web page.
S502, the server stores the target corresponding relation into a preset document.
The server can preset a preset document corresponding to the target webpage and store the target corresponding relation into the preset document.
S503, the server acquires the URL of the preset document and determines that the URL of the preset document is the target indication information corresponding to the target webpage.
The URL of the preset document represents an address where the preset document is stored.
Further, the server may obtain a compiled document of the target web page from the compiled documents of the web page items and transmit the compiled document of the target web page to the electronic device, in addition to transmitting the target indication information in S503 to the electronic device after S303.
The compiled document of the web page project may include at least one compiled document of a web page, and the server may obtain the compiled document of the target web page from the compiled document of the web page project.
In the embodiment of the present disclosure, the server may store the target corresponding relationship or the compiled indication information of the at least one static resource referred by the target webpage in the target corresponding relationship by using a preset document, and may also store the target corresponding relationship or the compiled indication information of the at least one static resource referred by the target webpage in the target corresponding relationship in the compiled document of the target webpage. Taking the general correspondence shown in fig. 3 and saving the target correspondence in the compiled document of the target web page as an example, as shown in fig. 8, the method is applied to the server. The web page resource acquisition method may include, before S202, S301 to S304, and S202 in the method may include S601 to S603.
S601, the server acquires a target corresponding relation from the total corresponding relation; the target correspondence is a correspondence that includes an identification of the target web page.
It should be noted that, for a specific description of S601, reference may be made to the above detailed description of S501, and details of the embodiment of the present disclosure are not repeated here.
S602, the server determines a compiling document of a target webpage; the compiled document of the target webpage is obtained by compiling the development document.
The server compiles the development document in S303, and further obtains a compiled document of the web page project, so that the compiled document of the target web page can be obtained from the compiled document of the web page project.
S603, the server stores the target corresponding relation to an entrance position of an HTML document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determines the modified compiled document of the target webpage to be target indication information corresponding to the target webpage.
In the embodiment of the present disclosure, the compiled document of the target webpage may include an HTML document, and the server may store the target correspondence in the HTML document in the compiled document of the target webpage.
For example, the server may add the target correspondence to the HTML document in the compiled document of the target web page at the entry position of the HTML document using the < script > tag, resulting in a modified compiled document of the target web page.
It should be noted that, in addition to storing the target correspondence relationship (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence relationship) in the preset document, the server obtains the URL of the preset document, so that the electronic device obtains the target correspondence relationship in the preset document (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence relationship) by accessing the URL of the preset document. The server may further add the target correspondence (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence) to an entry position of an HTML document in the compiled document of the webpage in a < script > tag form, and provide a channel for acquiring the target correspondence (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence) to the electronic device in a global variable form. Of course, the server may also provide the target correspondence (or compiled indication information of at least one static resource referenced by the target webpage in the target correspondence) to the electronic device in other manners, which is not limited in the embodiment of the present disclosure.
It can be understood that, the server adds the target correspondence (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence) to the entry position of the HTML document in the compiled document of the webpage, that is, injects the global variable to the entry position of the HTML document, and compared with the step of storing the target correspondence (or the compiled indication information of the at least one static resource referred by the target webpage in the target correspondence) in the preset document, the step of the electronic device loading the URL of the preset document to make a network request can be avoided. And the target corresponding relation (or the compiled indication information of at least one static resource referred by the target webpage in the target corresponding relation) is stored in a preset document, so that a variable can be prevented from being added to a global object in the HTML document.
Referring to fig. 9, a flowchart illustrating a web page resource obtaining method according to an exemplary embodiment, the method being applied to the electronic device installed with an application (e.g., a browser) for accessing and browsing a web page, may include S701-S705.
S701, the electronic equipment responds to an access operation of a target webpage and sends an acquisition request to a server; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage.
The electronic equipment receives the access operation of a user to a target webpage through an application program for accessing and browsing the webpage. Then, in response to the access operation, the electronic device may generate an acquisition request including an identifier of the target web page (e.g., a name of the target web page), and send the acquisition request to a server corresponding to the target web page. The server corresponding to the target webpage can provide data support for the target webpage.
Illustratively, the access operation may be an operation of loading a web page address of the target web page.
S702, the electronic equipment receives target indication information from the server.
S703, the electronic device obtains the URL of the at least one static resource quoted by the target webpage according to the target indication information.
The electronic equipment can determine a target corresponding relation or compiled indication information of at least one static resource quoted by a target webpage according to the target indication information; and acquiring the URL of at least one static resource quoted by the target webpage according to the target corresponding relation or the compiled indication information of at least one static resource quoted by the target webpage.
In this disclosure, in a case that the target indication information is the target corresponding relationship, the electronic device may obtain compiled indication information of at least one static resource referred by the target webpage from the target corresponding relationship. Then, the electronic device obtains the URL of the at least one static resource referenced by the target webpage according to the compiled indication information of the at least one static resource referenced by the target webpage.
In the embodiment of the present disclosure, in a case that the target indication information is the URL of the preset document, the electronic device may load the URL of the preset document to send a document acquisition request to the server. Then, the electronic equipment receives the preset document from the server; and acquiring the URL of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the preset document. The document acquisition request is used for requesting to acquire the preset document.
In this disclosure, in a case that the target indication information is the modified compiled document of the target webpage, the electronic device may run the modified compiled document of the target webpage to obtain the URL of the at least one static resource referenced by the target webpage according to the compiled indication information of the at least one static resource referenced by the target webpage.
It should be noted that, because the target correspondence relationship or the compiled indication information of the at least one static resource referred by the target webpage is located at the entry position of the HTML document in the modified compiled document of the target webpage, in the process of running the modified compiled document of the target webpage, the electronic device first obtains the URL of the at least one static resource referred by the target webpage according to the target correspondence relationship at the entry position or the compiled indication information of the at least one static resource referred by the target webpage.
In an embodiment of the present disclosure, the compiled indication information of the at least one static resource referred by the target webpage may include a compiled name of the at least one static resource or a URL of the at least one static resource. The electronic device may determine, according to the compiled indication information of the at least one static resource referred to by the target webpage, a URL of the at least one static resource referred to by the target webpage.
Specifically, when the compiled indication information of the at least one static resource referred to by the target webpage is a compiled name of the at least one static resource, the electronic device may obtain the URL of the at least one static resource referred to by the target webpage according to a preset URL prefix and the compiled name of the at least one static resource referred to by the target webpage.
Or, when the compiled indication information of the at least one static resource referred to by the target webpage is the URL of the at least one static resource, the electronic device may directly determine that the compiled indication information of the at least one static resource referred to by the target webpage is the URL of the at least one static resource referred to by the target webpage.
The preset URL prefix may refer to a location on the network where at least one static resource referenced by the target web page is stored. Presetting the URL prefix may include: a network Protocol (e.g., Hypertext Transfer Protocol (HTTP)), a domain name corresponding to a server storing at least one static resource referenced by a target web page (e.g., static.
The electronic equipment can combine the preset URL prefix and the compiled name of each static resource quoted by the target webpage to obtain the URL of each static resource quoted by the target webpage.
The preset URL prefix may be http:// static. The target web page may be web page a, and the compiled name of the static resource referenced by web page a may include x.hash0.jpg. The electronic device combines the preset URL prefix and the compiled name of the static resource referred by the web page a to obtain that the URL of the static resource referred by the web page a is: http:// static. com/image/x.hash0.jpg.
S704, the electronic equipment loads the URL of at least one static resource to send at least one resource acquisition request to the server; the resource obtaining request is used for requesting to obtain a corresponding static resource.
The electronic device loads the URL of each static resource to send a resource acquisition request to the server. Then, the electronic device may receive the static resource from the server, and at this time, the processing status of the resource obtaining request is that the downloading is successful. Or, the electronic device does not receive the static resource, and at this time, the processing state of the resource acquisition request is download failure.
Wherein, the at least one resource acquisition request and the URL of the at least one static resource are in one-to-one correspondence.
S705, the electronic device determines a processing state of the at least one resource acquisition request, and determines a download progress of the at least one static resource according to the processing state of the at least one resource acquisition request.
And the processing state of the resource acquisition request is the corresponding success or failure of downloading the static resource.
For example, the electronic device may count the number of successful downloads of the at least one resource acquisition request. And then, the electronic equipment determines the downloading progress of at least one static resource according to the number of successful downloading.
Referring to fig. 10, a flowchart of a method for acquiring web page resources according to an exemplary embodiment is shown, where the method is applied to a web page resource acquisition system, and the web page resource acquisition system may include: the method of the server and the electronic device installed with the application program (e.g., browser) for accessing and browsing the web page may include S201-S205, S701-S705.
It is understood that the server transmits the target indication information to the electronic device. Because the target indication information accurately indicates the at least one static resource referred by the target webpage, the electronic device can accurately acquire the at least one static resource referred by the target webpage according to the target indication information. Secondly, since the total correspondence includes a correspondence between compiled indication information of the static resource referred by the at least one web page, the total correspondence includes compiled indication information of the at least one static resource referred by the target web page. Therefore, the electronic device reads the total corresponding relationship, and the obtained target indication information corresponding to the target webpage is compiled indication information about at least one static resource referenced by the target webpage. Furthermore, the electronic device can successfully acquire the static resource in the target webpage according to the compiled indication information of the at least one static resource. In conclusion, the electronic device can successfully and accurately acquire the at least one static resource referenced by the target webpage according to the target indication information, and the problem of omission or redundancy does not exist.
In the embodiment of the present disclosure, the electronic device may receive a compiled document of a target webpage from the server in addition to the target indication information in S503 from the server. The target indication information is a URL of a preset document. The electronic equipment acquires the static resource quoted by the target webpage according to the target indication information, and then generates and displays the page of the target webpage according to the compiled document of the target webpage and the acquired static resource quoted by the target webpage. Fig. 11 is a flowchart of a web page resource obtaining method, which is applied to the electronic device installed with an application program (e.g., a browser) for accessing and browsing a web page. The method may further include S706 after S701, and the method may further include S707-S708 after S704.
S706, the electronic equipment receives the compiled document of the target webpage from the server.
It should be noted that the electronic device may execute S706 and S702 at the same time, or execute S706 first and then execute S702, and the execution sequence of S706 and S702 is not limited in the embodiment of the present disclosure.
S707, the electronic device receives the static resource referenced by the target webpage from the server.
S708, the electronic equipment generates and displays the page of the target webpage according to the compiled document of the target webpage and the obtained static resource quoted by the target webpage.
And the electronic equipment runs the compiled document of the target webpage, and generates and displays the page of the target webpage by combining the obtained static resource quoted by the target webpage.
In the embodiment of the disclosure, the page of the target webpage displayed by the electronic device may include part of all static resources referred by the acquired target webpage or all static resources referred by the acquired target webpage.
Further, the electronic device may continue to update the page of the target web page in response to the user's browsing operation of the target web page. And updating the static resources in the page of the target webpage.
Illustratively, the at least one static resource referenced by the target web page acquired by the electronic device includes x1.jpg, x2.jpg, x3.jpg, x4. mp 4. The pages of the target web page displayed by the electronic device may include x1.jpg and x4. mp 4. Then, in response to a user browsing operation on the target webpage, the electronic device may display the updated page of the target webpage including x2.jpg and x3. jpg.
Illustratively, the target webpage may be a webpage of an SPA, and the page of the target webpage displayed by the electronic device includes a part of the static resources referenced by the SPA. When the electronic equipment responds to the access operation of the user to other pages of the SPA, the pages of the target webpage are updated, and the other pages are displayed.
In the embodiment of the present disclosure, the electronic device receives target indication information in S603 from the server, where the target indication information is a modified compiled document of the target web page. The electronic equipment runs the modified compiled document of the target webpage, and first obtains the static resource quoted by the target webpage according to the target corresponding relation (or the compiled indication information of at least one static resource quoted by the target webpage) in the modified compiled document of the target webpage; and then, generating and displaying the page of the target webpage by using the static resource quoted by the acquired target webpage.
Continuing with the target correspondence relationship as an example, fig. 12 is a flowchart of a web page resource obtaining method, which is applied to the electronic device installed with an application program (e.g., a browser) for accessing and browsing a web page. The method may include, after S704, S801-S802.
S801, the electronic device receives static resources referenced by the target webpage from the server.
S802, the electronic equipment generates and displays a page of the target webpage according to the modified compiled document of the target webpage and the acquired static resource quoted by the target webpage.
And the electronic equipment runs the modified compiled document of the target webpage, and generates and displays the page of the target webpage by using the static resource quoted by the acquired target webpage.
It should be noted that, for a specific description about displaying the page of the target webpage in S802, reference may be made to the above-mentioned detailed description about displaying the page of the target webpage in S708, which is not repeated herein in this disclosure.
In the embodiment of the disclosure, the electronic device first acquires at least one static resource referred by the target webpage, and then generates the page of the target webpage by using the acquired static resource referred by the target webpage. Therefore, the electronic device cannot display the page of the target webpage in the process of acquiring the at least one static resource referenced by the target webpage. In order to reduce the situation that the user terminates accessing the target webpage due to blind waiting of the user, the electronic device may determine prompt information representing the downloading progress of the at least one static resource referenced by the target webpage while acquiring the at least one static resource referenced by the target webpage.
Exemplarily, taking as an example that the target indication information is the URL of the preset document, the preset document includes the target corresponding relationship, and the compiled indication information of the at least one static resource referred by the target webpage includes the URL of the at least one static resource referred by the target webpage, as shown in the flowchart of a webpage resource obtaining method shown in fig. 13, the method is applied in the webpage resource obtaining system, the method may include S901 to S902 after S702, S703 in the method may include S903 to S905, and the method may not include S705 but include S906 to S910 after S704.
S901, the server acquires the compiled document of the target webpage and sends the compiled document of the target webpage to the electronic equipment; the compiled document of the target webpage is compiled from the development document of the webpage project.
The server compiles the development documents of the webpage projects to obtain the total corresponding relation, and also obtains the compiled documents of the webpage projects, so that the compiled documents of the target webpage can be obtained from the compiled documents of the webpage projects.
S902, the electronic equipment receives a compiled document of a target webpage from a server.
S903, the electronic equipment loads the URL of the preset document so as to send a document acquisition request to the server.
The document obtaining request is used for requesting to obtain a preset document.
S904, the server responds to the document acquisition request and sends a preset document to the electronic equipment; the preset document stores a target corresponding relation; the target correspondence is a correspondence that includes an identification of the target web page.
S905, the electronic equipment receives a preset document from the server, and determines the URL of at least one static resource quoted by the target webpage according to the target corresponding relation in the preset document.
The preset document stores a target corresponding relation. If the compiled indication information of the at least one static resource referred by the target webpage in the target corresponding relationship is the URL of the at least one static resource referred by the target webpage, the electronic device directly obtains the URL of the at least one static resource referred by the target webpage from the target corresponding relationship. If the compiled indication information of the at least one static resource quoted by the target webpage in the target corresponding relationship is the compiled name of the at least one static resource quoted by the target webpage, the electronic equipment combines the preset URL prefix and the compiled name of each static resource quoted by the target webpage to obtain the URL of each static resource quoted by the target webpage.
S906, the electronic equipment receives the static resource quoted by the target webpage from the server and determines the processing state of at least one resource acquisition request.
The successful receiving of the static resource corresponding to the at least one resource obtaining request indicates that the processing state of the at least one resource obtaining request is successful in downloading, and the failed receiving of the static resource corresponding to the at least one resource obtaining request indicates that the processing state of the at least one resource obtaining request is failed in downloading. The electronic device receives a successful static resource from the server, and determines that the processing status of the corresponding at least one resource acquisition request is download success. And if the electronic equipment fails to receive one static resource from the server, determining that the processing state of the corresponding at least one resource acquisition request is downloading failure.
S907, the electronic device counts the number of processing completion according to the processing state of the at least one resource acquisition request.
The processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading. When the electronic device determines that the processing state of one resource acquisition request is download success or download failure, it determines that the processing completion number K = K +1, and the initial value of K is 0.
It should be noted that, in order to improve the success rate of downloading the static resource, when it is determined that the processing state of a resource acquisition request is download failure, the electronic device may also specially process the resource acquisition request, for example, resend the resource acquisition request to the server. But this also increases the waiting time for the user. Therefore, the electronic device can mark one resource acquisition request with the processing status of download failure as complete, i.e. the number of processing completions is increased by 1. Meanwhile, when the processing state of a resource acquisition request is download failure, the electronic device can record the URL of the static resource corresponding to the resource acquisition request in a manner of buried point reporting and the like so as to solve the problem.
And S908, dividing the processing completion number for the electronic equipment by the total number of the at least one resource acquisition request to obtain a processing completion ratio.
After the electronic device determines that the processing completion number K = K +1, dividing K by the total number N of the at least one resource acquisition request to obtain a processing completion ratio. The processing completion ratio is a download progress of the at least one static resource.
And S909, the electronic equipment displays the processing completion ratio or prompt information for representing the processing completion ratio.
The electronic device may display the process completion ratio or display a prompt characterizing the process completion ratio, such as a progress bar or other graphic characterizing the process completion ratio.
S910, when the processing completion ratio is equal to 1, the electronic equipment removes the processing completion ratio or the prompt message, and displays the page of the target webpage according to the compiled document of the target webpage and the obtained static resource quoted by the target webpage.
When the processing completion value is equal to 1, the electronic device may determine that the at least one static resource referenced by the target web page has been completely loaded, remove/delete the displayed processing completion ratio or the prompt message, and display the page of the target web page. The static resource referred by the acquired target webpage can be stored in the cache, and the electronic device can read the static resource referred by the acquired target webpage from the cache for rendering the page of the target webpage.
The static resource referred by the target webpage acquired by the electronic device may be all static resources in the corresponding relationship including the identifier of the target webpage or a part of static resources in the corresponding relationship including the identifier of the target webpage.
It can be understood that, since the target indication information accurately records at least one static resource referenced by the target webpage, the electronic device may request the server to acquire only all static resources referenced by the target webpage according to the target indication information, that is, at least one resource acquisition request sent to the server is only used for requesting to acquire all static resources referenced by the target webpage. Then, the electronic device determines whether the processing state of the at least one resource acquisition request is a successful downloading state or a downloading state, and the determined processing completion number only indicates that all static resources referenced by the target webpage are successfully acquired or unsuccessfully acquired. Therefore, the processing completion number can accurately represent the downloading progress of the at least one static resource referenced by the target webpage.
The embodiment of the present disclosure may perform division of function modules on the web resource acquisition device and the like according to the method example, for example, each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, the division of the modules in the embodiments of the present disclosure is illustrative, and is only one division of logic functions, and there may be another division in actual implementation.
Fig. 14 is a block diagram illustrating a web page resource acquisition apparatus according to an example embodiment. Referring to fig. 14, the apparatus 1000 is applied to a server, and the apparatus 1000 includes: a receiving module 1001, a request processing module 1002 and a sending module 1003.
The receiving module 1001 is configured to receive an acquisition request from an electronic device; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage. The request processing module 1002 is configured to, in response to the acquisition request, read the total correspondence to obtain target indication information corresponding to the target webpage. A sending module 1003, configured to send the target indication information to the electronic device. A receiving module 1001, configured to receive at least one resource obtaining request from an electronic device; each resource obtaining request in the at least one resource obtaining request is used for requesting to obtain a static resource referenced by the target webpage. The request processing module 1002 is further configured to, in response to each resource obtaining request, obtain one static resource referenced by the target web page. The sending module 1003 is further configured to send a static resource referenced by the target web page to the electronic device. Whether the at least one static resource is successfully transmitted to the electronic equipment is used for representing the downloading progress of the at least one static resource.
The total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The at least one web page includes a target web page. The target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage.
In one possible embodiment, the output content is at least one resource directory corresponding to at least one web page. The apparatus 1000 also includes a resource determination module 1004. A resource determination module 1004 to: before receiving an acquisition request from the electronic equipment, acquiring a development document of a webpage project; determining at least one resource directory; compiling a development document, and correspondingly storing compiled indication information of static resources quoted by at least one compiled webpage into at least one resource directory according to the corresponding relation between the at least one webpage and the indication information quoted by the at least one webpage before compiling to obtain at least one updated resource directory; and obtaining the total corresponding relation according to the updated at least one resource directory.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage. The at least one resource directory is in one-to-one correspondence with the at least one web page.
In another possible implementation, the resource determining module 1004 is specifically configured to: traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain a compiled name of the static resource quoted by each webpage; and generating the compiled URL of the static resource quoted by each webpage according to the preset URL prefix and the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between at least one webpage and the compiled URL of the static resource quoted by at least one webpage is the total corresponding relation.
The preset URL prefix refers to an address of a static resource which is stored in the network and is referred by at least one webpage.
In another possible implementation, the resource determining module 1004 is specifically configured to: and traversing the resource directory corresponding to each webpage in the updated at least one resource directory aiming at each webpage in the at least one webpage to obtain the compiled name of the static resource quoted by each webpage, and determining that the corresponding relation between the compiled names of the static resource quoted by the at least one webpage and the at least one webpage is the total corresponding relation.
In another possible implementation, the output content is a compiled name of the static resource. A resource determination module 1004 to: before the acquisition request from the electronic equipment is received, acquiring a development document of a webpage project; compiling a development document, and marking the compiled name of the static resource to be compiled with the corresponding webpage identifier according to the corresponding relationship between the at least one webpage and the pre-compiled indication information of the static resource quoted by the at least one webpage; and obtaining the total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
Wherein the development document includes: and the at least one webpage and the indication information before compiling of the static resource referred by the at least one webpage.
In another possible implementation manner, the request processing module 1002 is specifically configured to: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage into a preset document; and acquiring the URL of the preset document, and determining the URL of the preset document as target indication information.
The URL of the preset document represents an address where the preset document is stored.
In another possible implementation manner, the request processing module 1002 is specifically configured to: acquiring a corresponding relation comprising an identifier of a target webpage from the total corresponding relation; the correspondence including the identification of the target web page includes: compiled indication information of at least one static resource referenced by the target web page; determining a compiled document of a target webpage; compiling the compiling document of the target webpage is obtained by compiling the development document; and storing the corresponding relation including the identification of the target webpage or the compiled indication information of at least one static resource quoted by the target webpage to an entry position of a hypertext markup language document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determining the modified compiled document of the target webpage as the target indication information.
Fig. 15 is a block diagram illustrating a web page resource acquisition apparatus according to an example embodiment. Referring to fig. 15, the apparatus 1100 is applied to an electronic device, and the apparatus 1100 includes: a sending module 1101, a receiving module 1102, a resource obtaining module 1103 and an information prompting module 1104.
The sending module 1101 is configured to send an acquisition request to a server in response to an access operation on a target webpage; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage. A receiving module 1102, configured to receive target indication information from a server. A resource obtaining module 1103, configured to obtain, according to the target indication information, a URL of at least one static resource referenced by the target web page; loading the URL of at least one static resource to send at least one resource acquisition request to a server; the resource obtaining request is used for requesting to obtain a corresponding static resource. The information prompting module 1104 is configured to determine a processing state of the at least one resource acquisition request, and determine a download progress of the at least one static resource according to the processing state of the at least one resource acquisition request. The processing state of the resource acquisition request is the successful downloading or the failed downloading of the corresponding static resource.
The target indication information is used for representing compiled indication information of at least one static resource quoted by the target webpage; the target indication information is obtained from the overall correspondence. The total correspondence is used for representing compiled indication information of static resources respectively quoted by at least one webpage in the webpage items. The overall correspondence is obtained by adjusting the output content when compiling the development document of the web project. The target web page belongs to at least one web page.
In a possible implementation, the target indication information is a URL of a preset document, and the preset document is used for storing compiled indication information of at least one static resource referenced by the target webpage. The resource obtaining module 1103 is specifically configured to: loading a URL of a preset document to send a document acquisition request to a server; the document acquisition request is used for requesting to acquire a preset document; receiving a preset document from a server; and acquiring the URL of the at least one static resource quoted by the target webpage according to the compiled indication information of the at least one static resource quoted by the target webpage.
In another possible implementation, the target indication information is a modified compiled document of the target web page; compiled indication information of at least one static resource referenced by the target webpage is stored at an entry position of the hypertext markup language document in the modified compiled document of the target webpage. The resource obtaining module 1103 is specifically configured to: and acquiring the URL of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the revised compiled document of the target webpage.
In another possible embodiment, the compiled indication information of the at least one static resource referred by the target webpage is a compiled name of the at least one static resource or a URL of the at least one static resource. The resource obtaining module 1103 is specifically configured to: under the condition that the compiled indication information of the at least one static resource quoted by the target webpage is the compiled name of the at least one static resource, generating a compiled URL of the at least one static resource quoted by the target webpage according to a preset URL prefix and the compiled name of the at least one static resource quoted by the target webpage; in a case that the compiled indication information of the at least one static resource referred to by the target webpage is a URL of the at least one static resource, it is determined that the compiled indication information of the at least one static resource referred to by the target webpage is the URL of the at least one static resource referred to by the target webpage.
The preset URL prefix refers to an address of at least one static resource referenced by a target webpage stored on a network.
In another possible implementation, the information prompting module 1104 is further configured to, after the URL of the at least one static resource is loaded to send the at least one resource acquisition request to the server, count the number of completed processing according to the processing state of the at least one resource acquisition request; the processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading; and dividing the processing completion number by the total number of the at least one resource acquisition request to obtain a processing completion ratio.
The apparatus 1100 also includes a display module 1105. A display module 1105, configured to display the processing completion ratio or prompt information for representing the processing completion ratio.
In another possible implementation manner, the receiving module 1102 is further configured to receive a compiled document of a target webpage from the server after the obtaining request is sent to the server; and after the URL of the at least one static resource is loaded so as to send at least one resource acquisition request to the server, receiving the static resource referenced by the target webpage from the server. The apparatus 1100 also includes a page generation module 1106. The page generating module 1106 is configured to generate a page of the target webpage according to the compiled document of the target webpage and the obtained static resource referred by the target webpage. The display module 1105 is further configured to display the page of the target webpage.
In another possible embodiment, the receiving module 1102 is further configured to receive the static resource referenced by the target webpage from the server after the URL of the at least one static resource is loaded to send the at least one resource obtaining request to the server. The page generating module 1106 is configured to generate a page of the target web page according to the modified compiled document of the target web page and the obtained static resource referred by the target web page. The display module 1105 is further configured to display the page of the target webpage.
In the case of integrated units, fig. 16 shows a possible structural diagram of the server involved in the above-described embodiment. The server 1200 may include: a processor 1201 and a memory 1202 for storing instructions executable by the processor 1201. Wherein the processor 1201 is configured to execute the instructions, so that the server 1200 executes the web page resource obtaining method executed by the server as described above.
The processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like, among others. The processor 1201 may include an Application Processor (AP), a modem processor, a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
Fig. 17 shows a schematic diagram of a possible structure of the electronic device according to the above-described embodiment, in the case of an integrated unit. The electronic device 1300 may include: a processor 1301 and a memory 1302 for storing instructions executable by the processor 1301; wherein, the processor 1301 is configured to execute the instructions, so that the electronic device 1300 executes the webpage resource obtaining method executed by the electronic device as described above.
In an exemplary embodiment, a web page resource acquisition system is also provided, which includes the server 1200 and the electronic device 1300. The server 1200 is configured to execute the web resource obtaining method executed by the server; the electronic device 1300 is configured to execute the web resource acquisition method executed by the electronic device as described above.
In an exemplary embodiment, a computer-readable storage medium including instructions, such as the memory 1201 including instructions, the memory 1302 including instructions executable by the processor 1201 of the server 1200 to perform the web resource acquisition method performed by the server, or the instructions executable by the processor 1301 of the electronic device 1300 to perform the web resource acquisition method performed by the electronic device, is also provided. Alternatively, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is further provided, which includes instructions that, when executed by the server or the electronic device, implement a web resource acquisition method that causes the server or the electronic device to execute.
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 disclosure is intended to cover any variations, 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 will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (32)
1. A webpage resource obtaining method is applied to a server, and the method comprises the following steps:
receiving an acquisition request from the electronic equipment; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage;
responding to the acquisition request, reading a total corresponding relation, obtaining target indication information corresponding to the target webpage, and sending the target indication information to the electronic equipment; the total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project; the total corresponding relation is obtained by adjusting output content when compiling the development document of the webpage project; the at least one web page comprises the target web page; the target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage;
receiving at least one resource acquisition request from the electronic device; each resource acquisition request in the at least one resource acquisition request is used for requesting to acquire a static resource referenced by the target webpage;
responding to each resource acquisition request, and acquiring and sending a static resource referred by the target webpage to the electronic equipment; whether the at least one static resource is successfully sent to the electronic equipment is used for representing the downloading progress of the at least one static resource.
2. The method of claim 1, wherein the output content is at least one resource directory corresponding to the at least one web page; prior to the receiving the acquisition request from the electronic device, the method further comprises:
acquiring a development document of the webpage project; wherein the development document includes: the at least one webpage and the indication information before compiling of the static resources quoted by the at least one webpage are in corresponding relation;
determining the at least one resource directory; the at least one resource directory corresponds to the at least one webpage one by one;
compiling the development document, and correspondingly storing compiled indication information of the static resources quoted by the at least one webpage into the at least one resource directory according to the corresponding relation between the at least one webpage and the indication information of the static resources quoted by the at least one webpage before compiling to obtain at least one updated resource directory;
and obtaining the total corresponding relation according to the updated at least one resource directory.
3. The method according to claim 2, wherein obtaining the total correspondence according to the updated at least one resource directory comprises:
for each webpage in the at least one webpage, traversing a resource directory corresponding to each webpage in the updated at least one resource directory to obtain a compiled name of the static resource referred by each webpage;
generating a compiled uniform resource locator of the static resource referred by each webpage according to a preset uniform resource locator prefix and the compiled name of the static resource referred by each webpage, and determining that the corresponding relationship between the at least one webpage and the compiled uniform resource locator of the static resource referred by the at least one webpage is the total corresponding relationship;
the preset uniform resource locator prefix refers to an address where static resources referred by the at least one webpage are stored on a network.
4. The method according to claim 2, wherein obtaining the total correspondence according to the updated at least one resource directory comprises:
for each webpage in the at least one webpage, traversing the resource directory corresponding to each webpage in the updated at least one resource directory to obtain a compiled name of the static resource referred by each webpage, and determining that the corresponding relationship between the at least one webpage and the compiled name of the static resource referred by the at least one webpage is the total corresponding relationship.
5. The method of claim 1, wherein the output content is a compiled name of a static resource; prior to the receiving the acquisition request from the electronic device, the method further comprises:
acquiring a development document of the webpage project; wherein the development document includes: the at least one webpage and the indication information before compiling of the static resources quoted by the at least one webpage are in corresponding relation;
compiling the development document, and marking the identifier of the webpage corresponding to the compiled name of the static resource obtained by compiling according to the corresponding relation between the at least one webpage and the indication information of the static resource quoted by the at least one webpage before compiling;
and obtaining the total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
6. The method according to any one of claims 1 to 5, wherein the reading the total correspondence to obtain target indication information corresponding to the target webpage includes:
acquiring a corresponding relation comprising the identification of the target webpage from the total corresponding relation; the correspondence including the identifier of the target web page includes: compiled indication information of static resources referenced by the target webpage;
storing the corresponding relation including the identification of the target webpage or the compiled indication information of the static resource quoted by the target webpage into a preset document;
acquiring a uniform resource locator of the preset document, and determining the uniform resource locator of the preset document as the target indication information; and the uniform resource locator of the preset document represents an address in which the preset document is stored.
7. The method according to any one of claims 1 to 5, wherein the reading the total correspondence to obtain target indication information corresponding to the target webpage includes:
acquiring a corresponding relation comprising the identification of the target webpage from the total corresponding relation; the correspondence including the identifier of the target web page includes: compiled indication information of static resources referenced by the target webpage;
determining a compiled document of the target webpage; compiling the compiling document of the target webpage is obtained by compiling the developing document;
and storing the corresponding relation including the identification of the target webpage or the compiled indication information of the static resource quoted by the target webpage to an entry position of a hypertext markup language document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determining the modified compiled document of the target webpage as the target indication information.
8. A webpage resource obtaining method is applied to electronic equipment, and the method comprises the following steps:
responding to the access operation of the target webpage, and sending an acquisition request to a server; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage;
receiving target indication information from the server; the target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage; the target indication information is obtained from the total corresponding relation; the total corresponding relation is used for representing compiled indication information of static resources quoted by at least one webpage in the webpage project; the total corresponding relation is obtained by adjusting output content when compiling the development document of the webpage project; the target webpage belongs to the at least one webpage;
acquiring a uniform resource locator of at least one static resource quoted by the target webpage according to the target indication information;
loading a uniform resource locator of the at least one static resource to send at least one resource acquisition request to the server; the resource acquisition request is used for requesting to acquire a corresponding static resource;
determining the processing state of the at least one resource acquisition request, and determining the downloading progress of the at least one static resource according to the processing state of the at least one resource acquisition request; and the processing state of the resource acquisition request is the successful downloading or failed downloading of the corresponding static resource.
9. The method according to claim 8, wherein the target indication information is a uniform resource locator of a preset document, and the preset document is used for saving compiled indication information of at least one static resource referenced by the target webpage;
wherein, the acquiring the uniform resource locator of the at least one static resource referenced by the target webpage according to the target indication information includes:
loading a uniform resource locator of the preset document to send a document acquisition request to the server; the document acquisition request is used for requesting to acquire the preset document;
receiving the preset document from the server;
and acquiring a uniform resource locator of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage.
10. The method of claim 8, wherein the target indication information is a modified compiled document of the target web page; compiled indication information of at least one static resource quoted by the target webpage is stored at the entry position of a hypertext markup language document in the modified compiled document of the target webpage;
wherein, the acquiring the uniform resource locator of the at least one static resource referenced by the target webpage according to the target indication information includes:
and acquiring a uniform resource locator of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the revised compiled document of the target webpage.
11. The method according to claim 9 or 10, wherein the compiled indication information of the at least one static resource referenced by the target webpage is a compiled name of the at least one static resource or a uniform resource locator of the at least one static resource;
wherein, the acquiring the uniform resource locator of the at least one static resource quoted by the target webpage according to the compiled indication information of the at least one static resource quoted by the target webpage comprises:
generating a compiled uniform resource locator of at least one static resource referred by the target webpage according to a preset uniform resource locator prefix and a compiled name of the at least one static resource referred by the target webpage under the condition that the compiled indication information of the at least one static resource referred by the target webpage is the compiled name of the at least one static resource; the preset uniform resource locator prefix refers to an address of at least one static resource referred by the target webpage stored in a network;
determining that the compiled indication information of the at least one static resource referred to by the target webpage is a uniform resource locator of the at least one static resource, if the compiled indication information of the at least one static resource referred to by the target webpage is the uniform resource locator of the at least one static resource referred to by the target webpage.
12. The method according to any of claims 8-10, wherein after said loading a uniform resource locator of said at least one static resource to send at least one resource acquisition request to said server, the method further comprises:
counting the number of processing completion according to the processing state of the at least one resource acquisition request; the processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading;
dividing the processing completion number by the total number of the at least one resource acquisition request to obtain a processing completion ratio;
and displaying the processing completion ratio or prompt information representing the processing completion ratio.
13. The method of claim 9, wherein after sending the fetch request to the server, the method further comprises:
receiving a compiled document of the target web page from the server;
wherein, after the loading the uniform resource locator of the at least one static resource to send at least one resource acquisition request to the server, the method further comprises:
receiving, from the server, a static resource referenced by the target web page;
and generating and displaying the page of the target webpage according to the compiled document of the target webpage and the acquired static resource quoted by the target webpage.
14. The method of claim 10, wherein after the loading the uniform resource locator of the at least one static resource to send at least one resource acquisition request to the server, the method further comprises:
receiving, from the server, a static resource referenced by the target web page;
and generating and displaying the page of the target webpage according to the modified compiled document of the target webpage and the acquired static resource quoted by the target webpage.
15. A webpage resource acquisition device is applied to a server, and the device comprises: the device comprises a receiving module, a request processing module and a sending module;
the receiving module is used for receiving an acquisition request from the electronic equipment; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage;
the request processing module is used for responding to the acquisition request, reading the total corresponding relation and obtaining target indication information corresponding to the target webpage; the total corresponding relation is used for representing compiled indication information of static resources which are respectively quoted by at least one webpage in the webpage project; the total corresponding relation is obtained by adjusting output content when compiling the development document of the webpage project; the at least one web page comprises the target web page; the target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage;
the sending module is used for sending the target indication information to the electronic equipment;
the receiving module is further configured to receive at least one resource acquisition request from the electronic device; each resource obtaining request in the at least one resource obtaining request is used for requesting to obtain a static resource referred by the target webpage;
the request processing module is further configured to respond to each resource acquisition request and acquire one static resource referenced by the target webpage;
the sending module is further configured to send a static resource referred by the target webpage to the electronic device; whether the at least one static resource is successfully sent to the electronic equipment is used for representing the downloading progress of the at least one static resource.
16. The apparatus of claim 15, wherein the output content is at least one resource directory corresponding to the at least one web page; the device further comprises: a resource determination module;
the resource determination module is configured to:
acquiring a development document of the webpage project; wherein the development document includes: the at least one webpage and the indication information before compiling of the static resources quoted by the at least one webpage are in corresponding relation;
determining the at least one resource directory; the at least one resource directory corresponds to the at least one webpage one by one;
compiling the development document, and correspondingly storing compiled indication information of the static resources quoted by the at least one webpage into the at least one resource directory according to the corresponding relation between the at least one webpage and the indication information of the static resources quoted by the at least one webpage before compiling to obtain at least one updated resource directory;
and obtaining the total corresponding relation according to the updated at least one resource directory.
17. The apparatus of claim 16, wherein the resource determination module is specifically configured to:
for each webpage in the at least one webpage, traversing a resource directory corresponding to each webpage in the updated at least one resource directory to obtain a compiled name of the static resource referred by each webpage;
generating a compiled uniform resource locator of the static resource referred by each webpage according to a preset uniform resource locator prefix and the compiled name of the static resource referred by each webpage, and determining that the corresponding relationship between the at least one webpage and the compiled uniform resource locator of the static resource referred by the at least one webpage is the total corresponding relationship;
the preset uniform resource locator prefix refers to an address where static resources referred by the at least one webpage are stored on a network.
18. The apparatus of claim 16, wherein the resource determination module is specifically configured to:
for each webpage in the at least one webpage, traversing the resource directory corresponding to each webpage in the updated at least one resource directory to obtain a compiled name of the static resource referred by each webpage, and determining that the corresponding relationship between the at least one webpage and the compiled name of the static resource referred by the at least one webpage is the total corresponding relationship.
19. The apparatus of claim 15, wherein the output content is a compiled name of a static resource; the device further comprises: a resource determination module;
the resource determination module is configured to: before the acquisition request from the electronic equipment is received, acquiring a development document of the webpage project; wherein the development document includes: the at least one webpage and the indication information before compiling of the static resources quoted by the at least one webpage are in corresponding relation;
compiling the development document, and marking the identifier of the webpage corresponding to the compiled name of the static resource obtained by compiling according to the corresponding relation between the at least one webpage and the indication information of the static resource quoted by the at least one webpage before compiling;
and obtaining the total corresponding relation according to the identification of the webpage marked by the compiled name of the static resource obtained by compiling.
20. The apparatus of any one of claims 15-19,
the request processing module is specifically configured to:
acquiring a corresponding relation comprising the identification of the target webpage from the total corresponding relation; the correspondence including the identifier of the target web page includes: compiled indication information of static resources referenced by the target webpage;
storing the corresponding relation including the identification of the target webpage or the compiled indication information of the static resource quoted by the target webpage into a preset document;
acquiring a uniform resource locator of the preset document, and determining the uniform resource locator of the preset document as the target indication information; and the uniform resource locator of the preset document represents an address in which the preset document is stored.
21. The apparatus of any one of claims 15-19,
the request processing module is specifically configured to:
acquiring a corresponding relation comprising the identification of the target webpage from the total corresponding relation; the correspondence including the identifier of the target web page includes: compiled indication information of static resources referenced by the target webpage;
determining a compiled document of the target webpage; compiling the compiling document of the target webpage is obtained by compiling the developing document;
and storing the corresponding relation including the identification of the target webpage or the compiled indication information of the static resource quoted by the target webpage to an entry position of a hypertext markup language document in the compiled document of the target webpage to obtain a modified compiled document of the target webpage, and determining the modified compiled document of the target webpage as the target indication information.
22. A webpage resource acquisition device is applied to electronic equipment, and the device comprises: the system comprises a sending module, a receiving module, a resource obtaining module and an information prompting module;
the sending module is used for responding to the access operation of the target webpage and sending an acquisition request to the server; the acquisition request is used for requesting to acquire compiled indication information of the static resource quoted by the target webpage;
the receiving module is used for receiving target indication information from the server; the target indication information is used for representing compiled indication information of at least one static resource referenced by the target webpage; the target indication information is obtained from the total corresponding relation; the total corresponding relation is used for representing compiled indication information of static resources quoted by at least one webpage in the webpage project; the total corresponding relation is obtained by adjusting output content when compiling the development document of the webpage project; the target webpage belongs to the at least one webpage;
the resource acquisition module is used for acquiring a uniform resource locator of at least one static resource referenced by the target webpage according to the target indication information; loading a uniform resource locator of the at least one static resource to send at least one resource acquisition request to the server; the resource acquisition request is used for requesting to acquire a corresponding static resource;
the information prompting module is used for determining the processing state of the at least one resource acquisition request and determining the downloading progress of the at least one static resource according to the processing state of the at least one resource acquisition request; and the processing state of the resource acquisition request is the successful downloading or failed downloading of the corresponding static resource.
23. The apparatus according to claim 22, wherein the target indication information is a uniform resource locator of a preset document, and the preset document is used for saving compiled indication information of at least one static resource referenced by the target webpage;
the resource obtaining module is specifically configured to:
loading a uniform resource locator of the preset document to send a document acquisition request to the server; the document acquisition request is used for requesting to acquire the preset document;
receiving the preset document from the server;
and acquiring a uniform resource locator of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage.
24. The apparatus of claim 22, wherein the target indication information is a modified compiled document of the target web page; compiled indication information of at least one static resource quoted by the target webpage is stored at the entry position of a hypertext markup language document in the modified compiled document of the target webpage;
the resource obtaining module is specifically configured to:
and acquiring a uniform resource locator of at least one static resource quoted by the target webpage according to the compiled indication information of at least one static resource quoted by the target webpage in the revised compiled document of the target webpage.
25. The apparatus according to claim 23 or 24, wherein the compiled indication information of the at least one static resource referred by the target webpage is a compiled name of the at least one static resource or a uniform resource locator of the at least one static resource;
the resource obtaining module is specifically configured to:
generating a compiled uniform resource locator of at least one static resource referred by the target webpage according to a preset uniform resource locator prefix and a compiled name of the at least one static resource referred by the target webpage under the condition that the compiled indication information of the at least one static resource referred by the target webpage is the compiled name of the at least one static resource; the preset uniform resource locator prefix refers to an address of at least one static resource referred by the target webpage stored in a network;
determining that the compiled indication information of the at least one static resource referred to by the target webpage is a uniform resource locator of the at least one static resource, if the compiled indication information of the at least one static resource referred to by the target webpage is the uniform resource locator of the at least one static resource referred to by the target webpage.
26. The apparatus of any one of claims 22-24,
the information prompting module is further configured to count a processing completion number according to a processing state of the at least one resource acquisition request after the uniform resource locator loading the at least one static resource sends the at least one resource acquisition request to the server; the processing completion number is the number of the resource acquisition requests with the processing states of successful downloading or failed downloading; dividing the processing completion number by the total number of the at least one resource acquisition request to obtain a processing completion ratio;
the device further comprises: and the display module is used for displaying the processing completion ratio or prompt information representing the processing completion ratio.
27. The apparatus of claim 23, further comprising: the system comprises a page generation module and a display module;
the receiving module is further configured to receive a compiled document of the target webpage from the server after the obtaining request is sent to the server; after the uniform resource locator loading the at least one static resource sends at least one resource acquisition request to the server, receiving the static resource referenced by the target webpage from the server;
the page generating module is used for generating a page of the target webpage according to the compiled document of the target webpage and the obtained static resource quoted by the target webpage;
and the display module is used for displaying the page of the target webpage.
28. The apparatus of claim 24, further comprising: the system comprises a page generation module and a display module;
the receiving module is further configured to receive the static resource referred by the target webpage from the server after the uniform resource locator loading the at least one static resource sends at least one resource acquisition request to the server;
the page generating module is used for generating a page of the target webpage according to the modified compiled document of the target webpage and the acquired static resource quoted by the target webpage;
and the display module is used for displaying the page of the target webpage.
29. A webpage resource acquisition system is characterized by comprising a server and electronic equipment; wherein the server is used for executing the webpage resource obtaining method of any one of claims 1-7; the electronic device is used for executing the webpage resource obtaining method of any one of claims 8-14.
30. A server, characterized in that the server comprises: a processor and a memory for storing processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the web page resource acquisition method of any one of claims 1-7.
31. An electronic device, characterized in that the electronic device comprises: a processor and a memory for storing processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the web page resource acquisition method of any one of claims 8-14.
32. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of a server, enable the server to perform the web resource acquisition method of any one of claims 1-7;
alternatively, the instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the web page resource acquisition method of any of claims 8-14.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110773518.9A CN113326456B (en) | 2021-07-08 | 2021-07-08 | Webpage resource acquisition method, device, equipment, system and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110773518.9A CN113326456B (en) | 2021-07-08 | 2021-07-08 | Webpage resource acquisition method, device, equipment, system and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113326456A true CN113326456A (en) | 2021-08-31 |
CN113326456B CN113326456B (en) | 2022-01-21 |
Family
ID=77425977
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110773518.9A Active CN113326456B (en) | 2021-07-08 | 2021-07-08 | Webpage resource acquisition method, device, equipment, system and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113326456B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104965764A (en) * | 2015-06-02 | 2015-10-07 | 百度在线网络技术(北京)有限公司 | Static resource processing method and apparatus |
CN107169000A (en) * | 2017-03-31 | 2017-09-15 | 武汉斗鱼网络科技有限公司 | Static resource dissemination method and device |
US9830307B1 (en) * | 2014-12-11 | 2017-11-28 | Amazon Technologies, Inc. | Ahead of time compilation of content pages |
CN107704465A (en) * | 2016-08-08 | 2018-02-16 | 腾讯科技(深圳)有限公司 | Static resource update method and static resource management system |
CN111506387A (en) * | 2020-03-02 | 2020-08-07 | 百度在线网络技术(北京)有限公司 | Page pre-rendering method and device, electronic equipment and storage medium |
CN111782314A (en) * | 2020-05-22 | 2020-10-16 | 北京达佳互联信息技术有限公司 | Method and device for processing webpage form, electronic equipment and storage medium |
CN111783005A (en) * | 2020-07-08 | 2020-10-16 | 中国工商银行股份有限公司 | Method, apparatus and system for displaying web page, computer system and medium |
CN113065083A (en) * | 2021-02-26 | 2021-07-02 | 北京达佳互联信息技术有限公司 | Page processing method and device, electronic equipment and storage medium |
-
2021
- 2021-07-08 CN CN202110773518.9A patent/CN113326456B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9830307B1 (en) * | 2014-12-11 | 2017-11-28 | Amazon Technologies, Inc. | Ahead of time compilation of content pages |
CN104965764A (en) * | 2015-06-02 | 2015-10-07 | 百度在线网络技术(北京)有限公司 | Static resource processing method and apparatus |
CN107704465A (en) * | 2016-08-08 | 2018-02-16 | 腾讯科技(深圳)有限公司 | Static resource update method and static resource management system |
CN107169000A (en) * | 2017-03-31 | 2017-09-15 | 武汉斗鱼网络科技有限公司 | Static resource dissemination method and device |
CN111506387A (en) * | 2020-03-02 | 2020-08-07 | 百度在线网络技术(北京)有限公司 | Page pre-rendering method and device, electronic equipment and storage medium |
CN111782314A (en) * | 2020-05-22 | 2020-10-16 | 北京达佳互联信息技术有限公司 | Method and device for processing webpage form, electronic equipment and storage medium |
CN111783005A (en) * | 2020-07-08 | 2020-10-16 | 中国工商银行股份有限公司 | Method, apparatus and system for displaying web page, computer system and medium |
CN113065083A (en) * | 2021-02-26 | 2021-07-02 | 北京达佳互联信息技术有限公司 | Page processing method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113326456B (en) | 2022-01-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106294658B (en) | Webpage quick display method and device | |
US9846649B1 (en) | Providing files with cacheable portions | |
US8656265B1 (en) | Low-latency transition into embedded web view | |
EP3518124A1 (en) | Webpage rendering method and related device | |
US8527862B2 (en) | Methods for making ajax web applications bookmarkable and crawlable and devices thereof | |
US20170371974A1 (en) | Method for loading webpage, client and programmable device | |
CN104077310B (en) | Load the method, apparatus and system of resource file | |
CN107704615B (en) | Webpage font display method and system based on Chinese font subset | |
TW201800962A (en) | Webpage file sending method, webpage rendering method and device and webpage rendering system | |
CN113382083B (en) | Webpage screenshot method and device | |
US10116726B2 (en) | Methods for bundling images and devices thereof | |
TW201525740A (en) | Method and device for displaying web page and computer-readable storage medium | |
CN117390326A (en) | Page management method, device, equipment and storage medium | |
CN111460348B (en) | File processing method and device | |
CN113050942A (en) | Page generation method and device, readable medium and electronic equipment | |
CN113326456B (en) | Webpage resource acquisition method, device, equipment, system and storage medium | |
CN110020415B (en) | Chart processing method, system, computer device and storage medium | |
KR101092019B1 (en) | Web browsing system using the mobile web browser and method thereof and mobile terminal in the used the same | |
US20190042549A1 (en) | Method and apparatus for building pages, apparatus and non-volatile computer storage medium | |
JP2008123234A (en) | Translation server device, translation system, translation method, and translation program | |
EP2806350A1 (en) | Image forming firmware web-based user interface localization | |
US20140237133A1 (en) | Page download control method, system and program for ie core browser | |
CN113392351A (en) | Information processing method and device and storage medium | |
CN114528510A (en) | Webpage data processing method and device, electronic equipment and medium | |
CN107015826B (en) | Script file loading method, terminal and server |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |