CN112612982A - Webpage preloading method and device and computer equipment - Google Patents

Webpage preloading method and device and computer equipment Download PDF

Info

Publication number
CN112612982A
CN112612982A CN202110008104.7A CN202110008104A CN112612982A CN 112612982 A CN112612982 A CN 112612982A CN 202110008104 A CN202110008104 A CN 202110008104A CN 112612982 A CN112612982 A CN 112612982A
Authority
CN
China
Prior art keywords
universal resource
resource
webpage
universal
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110008104.7A
Other languages
Chinese (zh)
Inventor
黄春华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202110008104.7A priority Critical patent/CN112612982A/en
Publication of CN112612982A publication Critical patent/CN112612982A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Landscapes

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

Abstract

The application discloses a webpage preloading method, a webpage preloading device and computer equipment, wherein the method comprises the following steps: inquiring general resources and non-general resources of a lower-level webpage corresponding to a current webpage from a server, downloading and storing the general resources and the non-general resources to a cache unit preset by a browser; loading the universal resource to a page display process; receiving an access request of a target webpage triggered by a user based on the current page; inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resources to the page display process; and mounting the page display process to display the target page. The present application also provides a computer-readable storage medium. The webpage pre-loading method and device can effectively improve the efficiency of webpage pre-loading, and therefore the problem that execution efficiency is poor when subordinate webpages are too much is solved.

Description

Webpage preloading method and device and computer equipment
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method and an apparatus for preloading a webpage, and a computer device.
Background
With the development of network technology, the information amount of the current website is larger and larger, the information such as images, animations, layout, navigation and the like contained in one webpage is also extremely rich, and the display effect of the webpage is more and more vivid. However, the amount of data that needs to be loaded during the display of a web page is also increasing. For loading the web page, the corresponding web page is generally loaded according to the access request of the user, so that the more the data amount contained in the web page is, the longer the time required for loading is, and the longer the time for waiting by the user is.
In the prior art, a browser usually loads a static resource corresponding to a lower page of a top page of a web page to a page container corresponding to the browser in advance after the top page of the web page is displayed, so as to form a preloaded page of the lower page, and then when an access request of a user to the lower page is received, a dynamic resource of the lower page can be quickly acquired and rendered to the preloaded page, so that the speed of displaying the lower page is effectively increased.
Because the static resources required by the pages corresponding to different service functions are not consistent, the preloaded page can only accelerate the display speed of the page corresponding to one type of service function, and the lower-level page of one page does not only include the page of one type of service function. That is, the existing web page preloading method has low applicability and poor execution efficiency.
Disclosure of Invention
The application provides a webpage preloading method, a webpage preloading device and computer equipment, and can solve the problem that in the prior art, when lower-level webpages are excessive, execution efficiency is poor.
First, to achieve the above object, the present application provides a method for preloading a web page, where the method includes:
inquiring general resources and non-general resources of a lower-level webpage corresponding to a current webpage from a server, downloading and storing the general resources and the non-general resources to a cache unit preset by a browser; loading the universal resource to a page display process; receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage; inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resources to the page display process; and mounting the page display process to display the target page.
In one example, the generic resource includes at least one of an HTML resource, a JS resource, a CSS resource, and a picture resource.
In an example, the querying, according to the access request, the non-generic resource corresponding to the target web page from the cache unit includes: analyzing the resource parameters in the access request; and inquiring the non-universal resource corresponding to the target webpage in the cache unit according to the resource parameter.
In one example, the access request is a URL address, and the parsing out the resource parameter in the access request includes: analyzing a resource parameter field from the URL address according to a preset field format, and acquiring all resource key values of each resource type in the resource parameter field; and taking all resource key values as resource parameters corresponding to the access request.
In one example, the storing of the non-universal resource in a non-universal resource key assignment table and a non-universal resource file library, where the querying of the non-universal resource corresponding to the target web page in the cache unit according to the resource parameter includes: searching a corresponding non-universal resource file address in the non-universal resource key value table according to each resource key value in the resource parameters; and searching and calling the corresponding non-universal resource file from the non-universal resource file library according to the name of each non-universal resource file as the non-universal resource corresponding to the target webpage.
In one example, the loading the universal resource to a page display process includes: inquiring whether the cache unit stores the universal resource or not; when the universal resource is not stored in the cache unit, inquiring whether a preset strong cache stores the universal resource or not; if the universal resource is stored in the strong cache, calling the universal resource from the strong cache to load the universal resource to the page display process.
In an example, the querying, according to the access request, a non-universal resource corresponding to the target web page from the cache unit and loading the non-universal resource to the page display process includes: inquiring whether the cache unit stores the non-universal resource corresponding to the target webpage or not; when the cache unit does not store the non-universal resource corresponding to the target webpage, inquiring whether the strong cache stores the non-universal resource corresponding to the target webpage or not; if the non-universal resource corresponding to the target webpage is stored in the strong cache, calling the non-universal resource corresponding to the target webpage from the strong cache and loading the non-universal resource to the page display process.
In one example, the universal resource is a resource file library formed by respectively summarizing and combining universal resources for all web pages of each type of business function by taking a folder as a dimension.
In an example, when the non-universal resource corresponding to the target webpage is not successfully queried from the non-universal resources, the non-universal resource corresponding to the target webpage is directly downloaded from the server according to the access request.
In addition, to achieve the above object, the present application further provides a web page preloading device, including:
the downloading module is used for inquiring the universal resource and the non-universal resource of the lower-level webpage corresponding to the current webpage from the server, downloading and storing the universal resource and the non-universal resource to a cache unit preset by the browser; the loading module is used for loading the universal resource to a page display process; the receiving module is used for receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage; the loading module is further configured to query, according to the access request, the non-universal resource corresponding to the target webpage from the cache unit and load the non-universal resource to the page display process; and the display module is used for mounting the page display progress to display the target page.
Further, the present application also proposes a computer device, which includes a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the computer program, when executed by the processor, implements the steps of the web page preloading method as described above.
Further, to achieve the above object, the present application also provides a computer-readable storage medium storing a computer program, which is executable by at least one processor to cause the at least one processor to execute the steps of the web page preloading method as described above.
Compared with the prior art, the webpage preloading method, the webpage preloading device, the computer equipment and the computer readable storage medium can query the server for the universal resource and the non-universal resource of the subordinate webpage corresponding to the current webpage, and download and store the universal resource and the non-universal resource to the cache unit preset by the browser; loading the universal resource to a page display process; then receiving an access request of a target webpage triggered by a user based on the current page, inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request, and loading the non-universal resources to the page display process; and finally mounting the page display process to display the target page. By downloading the universal resources and the non-universal resources corresponding to the subordinate web pages of the current web page to the local, the access requests of the subordinate web pages can be triggered and then called quickly for rendering, the preloading efficiency of the web pages can be effectively improved, and the problem of poor execution efficiency when the subordinate web pages are excessive is solved.
Drawings
FIG. 1 is a schematic diagram of an application environment according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a web page preloading method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating the effects of the generation and invocation of generic and non-generic resources according to an illustrative example of the present application;
FIG. 4 is a flowchart illustrating an effect of a call performed on a generic/non-generic resource of a target page according to an illustrative embodiment of the present application;
FIG. 5 is a block diagram of program modules of an embodiment of the web page preloading device of the present application;
FIG. 6 is a diagram of an alternative hardware architecture of the computer device of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the descriptions in this application referring to "first", "second", etc. are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
Fig. 1 is a schematic diagram of an application environment according to an embodiment of the present application. Referring to fig. 1, the computer apparatus 1 is connected to a data server 2. When receiving an access request of a webpage home page, the computer device 1 may send a resource request of the webpage home page to the data server 2, then receive a resource of the webpage home page sent by the data server 2, then render the resource to a page display container and display the resource to a browser display window; meanwhile, the computer device 1 uses the home page of the web page as the current web page, queries the data server 2 for the universal resource and the non-universal resource of the subordinate web page corresponding to the current web page, downloads and stores the universal resource to a cache unit preset by the browser, and loads the universal resource to the page display process. When the computer device 1 receives an access request of a target webpage triggered by a user based on the current page, inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resources to the page display process; and finally mounting the page display process to display the target page. In the embodiment, the computer device 1 may be a mobile phone, a tablet, a portable device, a PC, or other electronic devices with a display function; the data server 2 can be used as a mobile phone, a tablet, a portable device, a PC or a server.
Example one
Fig. 2 is a flowchart illustrating an embodiment of a web page preloading method according to the present application. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. The following description is made by way of example with the computer apparatus 1 as the execution subject.
As shown in FIG. 2, the web page preloading method may include steps S200-S208.
Step S200, inquiring general resources and non-general resources of a lower-level webpage corresponding to the current webpage from a server, downloading and storing the general resources and the non-general resources to a cache unit preset by the browser.
Step S202, loading the universal resource to a page display process.
Specifically, the computer device 1 is connected to a data server 2, and the data server 2 stores web page data. The computer device 1 receives a request for accessing a home page of a web page from a user by providing an interactive interface, for example, by receiving a web page address input by a user terminal. After receiving the access request of the webpage home page, the computer device 1 may send a resource request of the webpage home page to the data server 2, then receive the resource of the webpage home page sent by the data server 2, and then render the resource to a page display container and display the resource to a browser display window. Meanwhile, the computer device 1 takes the home page of the web page as the current web page, inquires the data server 2 about the universal resource and the non-universal resource of the next level web page corresponding to the current web page, and downloads and stores the universal resource and the non-universal resource to a cache unit preset by the browser; then, the computer apparatus 1 loads the universal resource to a page display process. The page display process can be understood as a system process used for executing a series of processes including preparation and caching of page resources, rendering and displaying of the page resources and the like; a page display process includes memory locations required to execute the page process.
In this embodiment, the universal resource includes at least one of an HTML resource, a JS resource, a CSS resource, and a picture resource. Specifically, due to a web page, a variety of resources may be included, such as: HTML for displaying web page structures; a CSS for displaying a cascading style sheet; JS used for realizing the environment for executing the script; and pictures, etc., which can be displayed directly without looking up a database or processing by a program. In addition, there is data that needs to be processed by the program, or different data needs to be displayed on the page according to different conditions. For example, for a web page purchased on the internet, the web page resources generally include a commodity picture, a commodity purchasing component, a commodity detail part, an evaluation part, and the like. That is, most of the web pages with the same type of business function have the same type of web page resources, i.e., universal resources.
Therefore, the computer device 1 may download and cache the general resource and the non-general resource of the lower level web page corresponding to the current web page in the cache unit corresponding to the browser when the current web page is displayed. In this embodiment, the data server 2 sets, in advance, the common resource of the corresponding lower level web page for all web pages. The universal resource is a resource file library formed by respectively carrying out universal resource induction and combination on all webpages of each type of business functions by taking a folder as a dimension.
For example, because the cache list of the ServiceWorker of the browser and the packaging mode of the Webpack can only support updating under the unified GIT project, two projects across the GIT warehouses are different because the input and output paths of the Webpack are different, and the file path and the number of the two warehouses of the static resource cannot be shared; so it cannot write into the same ServiceWorker and neulsourcemapping in the browser. Therefore, the data server 2 needs to integrate the web pages corresponding to all projects into one GIT project, and the pages of different types of business functions are isolated by using a folder mode; then, JS and CSS file libraries, such as a UI frame of VUE, and some same service components and tool components, which are all used among different projects are extracted through the capability of Webpack to form an independent JS file and CSS files, then the related JS and CSS files of a single page in each project are separately packaged into corresponding JS and CSS files, all JS files are assembled into a JS file library, all CSS files are assembled into a CSS file library, and accordingly JS resource libraries and CSS resource libraries corresponding to all webpages, namely universal resources, are formed. In addition, for the downloaded non-universal resource, the non-universal resource is also stored in a preset storage position in the ServiceWorker, and is stored separately from the universal resource.
Of course, in this embodiment, the loading, by the computer device 1, the universal resource to the page display process further includes: inquiring whether the cache unit stores the universal resource or not; when the universal resource is not stored in the cache unit, inquiring whether a preset strong cache stores the universal resource or not; if the universal resource is stored in the strong cache, calling the universal resource from the strong cache to load the universal resource to the page display process.
For example, the cache unit stores the content according to a time sequence, and after the stored data reaches a preset capacity, the computer device 1 will take out and store the earliest stored data into the strong cache. Therefore, when the computer device 1 needs to call the universal resource and the universal resource is not queried in the cache unit, the strong cache is queried; if the universal resource is queried in the strong cache, the computer device 1 will load the universal resource to the page display process by calling the universal resource from the cache unit.
Step S204, receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage.
Step S206, inquiring the non-universal resource corresponding to the target webpage from the cache unit according to the access request, and loading the non-universal resource to the page display process.
Specifically, in the process of displaying the current web page, the computer device 1 may further receive an access request of a subordinate web page triggered by the user based on the current web page, for example, the user triggers an access request of a subordinate web page on a browser display interface of the computer device 1 in a touch or key click manner; then, the computer device 1 queries the non-universal resource corresponding to the target webpage from the cache unit according to the access request.
In a specific embodiment, the querying, by the computer device 1, the non-universal resource corresponding to the target web page from the cache unit according to the access request includes: analyzing the resource parameters in the access request; and inquiring the non-universal resource corresponding to the target webpage in the cache unit according to the resource parameter. For example, the request for the web page Resource is implemented by a URL (Uniform Resource Locator). Therefore, when the access request is a URL address, the computer device 1 parsing out the resource parameter in the access request includes: analyzing a resource parameter field from the URL address according to a field format, and acquiring all resource key values of each resource type in the resource parameter field; and taking all resource key values as resource parameters corresponding to the access request.
Correspondingly, the data server 2 presets that the non-universal resource is stored in a non-universal resource key value table and a non-universal resource file library, and then the computer device 1 queries the non-universal resource corresponding to the target webpage in the cache unit according to the resource parameter, including: searching a corresponding non-universal resource file address in the non-universal resource key value table according to each resource key value in the resource parameters; and searching and calling the corresponding non-universal resource file from the non-universal resource file library according to the name of each non-universal resource file as the non-universal resource corresponding to the target webpage.
Specifically, the data server 2 sets a non-universal resource key value table and a non-universal resource file for the non-universal resource in advance, and stores the key value of the non-universal resource and the non-universal resource file respectively, where the non-universal resource key value table includes a corresponding relationship between the key value and a resource file address, and the corresponding non-universal resource file can be found in the non-universal resource file repository through the resource file address. Therefore, the computer device 1 may first identify the key value of the universal resource from the access request, and then find out the corresponding non-universal resource file address in the non-universal resource key value table; and finally, searching and calling the corresponding non-universal resource file from the non-universal resource file library according to the name of the non-universal resource file, namely the non-universal resource corresponding to the target webpage.
In addition, in this embodiment, the querying, by the computer device 1, the non-universal resource corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resource to the page display process package further includes: inquiring whether the cache unit stores the non-universal resource corresponding to the target webpage or not; when the cache unit does not store the non-universal resource corresponding to the target webpage, inquiring whether the strong cache stores the non-universal resource corresponding to the target webpage or not; if the non-universal resource corresponding to the target webpage is stored in the strong cache, calling the non-universal resource corresponding to the target webpage from the strong cache and loading the non-universal resource to the page display process.
The strong cache unit is configured to store contents that cannot be stored in the cache unit, for example, the contents are stored in the cache unit according to a time sequence, and after the stored data reaches a preset capacity, the computer device 1 will take out and store the earliest stored data in the strong cache. Therefore, when the computer device 1 needs to call the non-universal resource corresponding to the target webpage and the non-universal resource corresponding to the target webpage is not queried in the cache unit, the strong cache is queried; if the non-universal resource corresponding to the target webpage is queried in the strong cache, the computer device 1 will invoke the non-universal resource corresponding to the target webpage from the cache unit to load the non-universal resource to the page display process.
Of course, if the computer device 1 does not successfully query the non-generic resource corresponding to the target webpage from the non-generic resources, the non-generic resource corresponding to the target webpage is directly downloaded from the server according to the access request. For example, the non-general resource is not updated after being downloaded, but the target webpage is updated, so that the downloaded non-general resource does not include the non-general resource of the target webpage, or when the non-general resource corresponding to the target webpage is not successfully called due to problems such as timeout generated in the process of querying the non-general resource by the computer device 1, the non-general resource corresponding to the target webpage is directly re-downloaded from the server according to the access request by the computer device 1.
Step S206, mounting the page display process to display the target page.
Specifically, after querying the non-universal resource corresponding to the target webpage from the cache unit according to the access request, the computer device 1 may mount the page display process and simultaneously load the non-universal resource corresponding to the target webpage into the page display process, where the method includes: rendering the universal resource and the non-universal resource corresponding to the target webpage in a page display process to a page container through a browser kernel, and then forming the target webpage and displaying the target webpage to a display window of a browser.
In this embodiment, after receiving the access request, the computer device 1 simultaneously mounts the page display process and loads the non-universal resource corresponding to the target webpage to the page display process. Because the pages are generally provided with animations when being mounted, one animation is basically 300ms, and the loading of non-universal resources can be realized within 300 ms; if the non-universal resource is waiting to be loaded, the time is about 120 ms. Therefore, the webpage preloading method can effectively improve the webpage loading speed.
FIG. 3 is a flowchart illustrating the flow effect of the generation and invocation of generic and non-generic resources according to an illustrative example of the present application, as shown in FIG. 3.
In this embodiment, the method for implementing the web page preloading by the computer device 1 needs to be based on a browser supporting strong cache and ServiceWorker cache capabilities, such as a browser with a browser kernel of wkweiew kernel or a browser kernel of a version above google blink5.6.2. In the process of setting the universal resources and the non-universal resources of the subordinate web pages for each web page, the data server 2 establishes a project folder, and then takes all the subordinate web pages as objects, and respectively counts and summarizes the web pages corresponding to different types of service functions according to the dimensions of the folder. Then, the data server 2 extracts the universal resources from the web page folders corresponding to the different types of page functions to form corresponding files, for example, the JS resources and the CSS resources in all the web pages corresponding to the service function 1 are respectively counted and summarized to form corresponding JS files and CSS files, that is, index. Meanwhile, the data server 2 analyzes each webpage from each webpage folder, so that non-universal resources of each webpage are obtained, including JS resources and CSS resources. The method comprises the non-universal resource files and the non-universal resource key values corresponding to the non-universal resource files.
When the computer device 1 displays the current page, it downloads the universal resource and the non-universal resource corresponding to the lower page of the current page to a cache unit preset by the browser. In this embodiment, the computer device 1 directly stores the universal resource in the cache unit, and stores the non-universal resource in a non-universal resource key value table and a non-universal resource file library. For example, the computer device 1 stores all JS files and CSS files corresponding to the universal resource in a resource file library in the cache unit, that is, serviceworker. Then, the computer device 1 calls the universal resource from the cache unit to load the universal resource to a page display process.
When receiving an access request of a lower-level web page based on the current page, the computer device 1 performs field analysis on the access request to obtain a key value representing a non-universal resource; inquiring a file address of a corresponding non-universal resource file from the non-universal resource key value table in Neulsourcemapping.js according to all key values; then searching out corresponding non-universal resources from a non-universal resource file library in the serviceworker.js according to the non-universal resource file address, and loading the non-universal resources serving as the non-universal resources of the lower-level page to a page display process; finally, the computer device 1 uses the generic resource and the non-generic resource in the page display process to render a pre-prepared page, that is, generates index.
Fig. 4 is a flowchart illustrating the effect of the call executed by the exemplary embodiment of the present application on the general/non-general resource of the target page, as shown in fig. 4.
In this embodiment, the computer device 1 downloads the general/non-general resource corresponding to the lower page according to the current page, and stores the general/non-general resource in a preset cache; then, before calling the general/non-general resources in the cache, inquiring whether the general/non-general resources exist in the cache; if so, the generic/non-generic resources are called from cache for loading and rendering to a page container. If the universal/non-universal resources do not exist in the cache, inquiring a preset strong cache, wherein the strong cache is used for storing the universal/non-universal resources which are removed from the cache and are originally stored when the universal/non-universal resources stored in the cache reach a certain storage amount; when the universal/non-universal resource exists in the strong cache, directly acquiring the universal/non-universal resource from the strong cache, and using the universal/non-universal resource for loading and rendering to a page container; if the universal/non-universal resource does not exist in the strong cache, the universal/non-universal resource is downloaded again from the data server 2 and stored in the strong cache, whether the universal/non-universal resource exists in the strong cache or not is judged, and the universal/non-universal resource is called for loading and rendering to a page container.
In summary, the webpage preloading method provided in this embodiment can query the server for the universal resource and the non-universal resource of the lower level webpage corresponding to the current webpage, download and store the universal resource to the cache unit preset in the browser, and load the universal resource to the page display process; then receiving an access request of a target webpage triggered by a user based on the current page, inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request, and loading the non-universal resources to the page display process; and finally mounting the page display process to display the target page. By downloading the universal resources and the non-universal resources corresponding to the subordinate web pages of the current web page to the local, the access requests of the subordinate web pages can be triggered and then called quickly for rendering, the preloading efficiency of the web pages can be effectively improved, and the problem of poor execution efficiency when the subordinate web pages are excessive is solved.
Example two
Fig. 5 is a block diagram schematically illustrating a web page preloading device according to a second embodiment of the present application, which may be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the second embodiment of the present application. The program modules referred to in the embodiments of the present application refer to a series of computer program instruction segments that can perform specific functions, and the following description will specifically describe the functions of the program modules in the embodiments.
As shown in fig. 5, the web page preloading device 400 may include a downloading module 410, a loading module 420, a receiving module 430, and a displaying module 440, wherein:
the downloading module 410 is configured to query the server for the universal resource and the non-universal resource of the lower level web page corresponding to the current web page, and download and store the universal resource and the non-universal resource to a cache unit preset in the browser. Wherein, the universal resource comprises at least one of HTML resource, JS resource, CSS resource and picture resource.
And the loading module 420 is used for loading the universal resource to a page display process.
A receiving module 430, configured to receive an access request of a target webpage triggered by a user based on the current webpage, where the target webpage is any lower level webpage of the current webpage.
The loading module 420 is further configured to query, according to the access request, the non-universal resource corresponding to the target webpage from the cache unit and load the non-universal resource to the page display process.
A display module 440, configured to mount the page display process to display the target page.
In an exemplary embodiment, the loading module 420 is further configured to: analyzing the resource parameters in the access request; and inquiring the non-universal resource corresponding to the target webpage in the cache unit according to the resource parameter. The access request is a URL address, and the loading module 420 is further configured to parse a resource parameter field from the URL address according to a preset field format, and acquire all resource key values of each resource type in the resource parameter field; and taking all resource key values as resource parameters corresponding to the access request.
In an exemplary embodiment, the downloading module 410 is further configured to store the non-universal resource in a non-universal resource key assignment table and a non-universal resource file repository; the loading module 420 is further configured to: searching a corresponding non-universal resource file address in the non-universal resource key value table according to each resource key value in the resource parameters; and searching and calling the corresponding non-universal resource file from the non-universal resource file library according to the name of each non-universal resource file as the non-universal resource corresponding to the target webpage.
In an exemplary embodiment, the universal resource is a resource file library formed by respectively summarizing and combining universal resources for all web pages of each type of business function by taking a folder as a dimension.
In an exemplary embodiment, the loading module 420 is further configured to: inquiring whether the cache unit stores the universal resource or not; when the universal resource is not stored in the cache unit, inquiring whether a preset strong cache stores the universal resource or not; if the universal resource is stored in the strong cache, calling the universal resource from the strong cache to load the universal resource to the page display process. Inquiring whether the cache unit stores the non-universal resource corresponding to the target webpage or not; when the cache unit does not store the non-universal resource corresponding to the target webpage, inquiring whether the strong cache stores the non-universal resource corresponding to the target webpage or not; if the non-universal resource corresponding to the target webpage is stored in the strong cache, calling the non-universal resource corresponding to the target webpage from the strong cache and loading the non-universal resource to the page display process.
In an exemplary embodiment, the download module 410 is further configured to: and when the non-universal resource corresponding to the target webpage is not successfully inquired from the non-universal resources, directly downloading the non-universal resource corresponding to the target webpage from the server according to the access request.
EXAMPLE III
Fig. 6 schematically shows a hardware architecture diagram of a computer device 1 suitable for implementing a web page preloading method according to a third embodiment of the present application. In the present embodiment, the computer device 1 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set or stored in advance. For example, the server may be a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) with a gateway function. As shown in fig. 6, the computer device 1 includes at least, but is not limited to: memory 510, processor 520, and network interface 530 may be communicatively linked to each other by a system bus. Wherein:
the memory 510 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 510 may be an internal storage module of the computer device 1, such as a hard disk or a memory of the computer device 1. In other embodiments, the memory 510 may also be an external storage device of the computer device 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 1. Of course, the memory 510 may also comprise both an internal memory module of the computer device 1 and an external memory device thereof. In this embodiment, the memory 510 is generally used for storing an operating system installed in the computer device 1 and various application software, such as program codes of a web page preloading method. In addition, the memory 510 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 520 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 520 is generally used for controlling the overall operation of the computer device 1, such as performing control and processing related to data interaction or communication with the computer device 1. In this embodiment, processor 520 is configured to execute program codes stored in memory 510 or process data.
Network interface 530 may include a wireless network interface or a wired network interface, and network interface 530 is typically used to establish communication links between computer device 1 and other computer devices. For example, the network interface 530 is used to connect the computer apparatus 1 with an external terminal through a network, establish a data transmission channel and a communication link between the computer apparatus 1 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It should be noted that FIG. 6 only shows a computer device having components 510 and 530, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the program code of the web page preloading method stored in the memory 510 can also be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 520) to implement the embodiment of the present application.
Example four
The present embodiments also provide a computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of:
inquiring general resources and non-general resources of a lower-level webpage corresponding to a current webpage from a server, downloading and storing the general resources and the non-general resources to a cache unit preset by a browser; loading the universal resource to a page display process; receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage; loading the universal resource to a page display process; inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resources to the page display process; and mounting the page display process to display the target page.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used for storing an operating system and various types of application software installed in the computer device, for example, the program code of the web page preloading method in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different from that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications that can be made by the use of the equivalent structures or equivalent processes in the specification and drawings of the present application or that can be directly or indirectly applied to other related technologies are also included in the scope of the present application.

Claims (12)

1. A method for preloading a webpage is characterized by comprising the following steps:
inquiring general resources and non-general resources of a lower-level webpage corresponding to a current webpage from a server, downloading and storing the general resources and the non-general resources to a cache unit preset by a browser;
loading the universal resource to a page display process;
receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage;
inquiring non-universal resources corresponding to the target webpage from the cache unit according to the access request and loading the non-universal resources to the page display process;
and mounting the page display process to display the target page.
2. The method for preloading web pages of claim 1, wherein the common resource comprises at least one of an HTML resource, a JS resource, a CSS resource, and a picture resource.
3. The method for preloading web pages according to claim 1, wherein the querying the non-universal resource corresponding to the target web page from the cache unit according to the access request comprises:
analyzing the resource parameters in the access request;
and inquiring the non-universal resource corresponding to the target webpage in the cache unit according to the resource parameter.
4. The web page preloading method of claim 3, wherein the access request is a URL address, and the parsing out the resource parameters in the access request comprises:
analyzing a resource parameter field from the URL address according to a preset field format, and acquiring all resource key values of each resource type in the resource parameter field;
and taking all resource key values as resource parameters corresponding to the access request.
5. The web page preloading method of claim 4, wherein the non-universal resource is stored in a non-universal resource key value table and a non-universal resource file library, and the querying the non-universal resource corresponding to the target web page in the cache unit according to the resource parameter comprises:
searching a corresponding non-universal resource file address in the non-universal resource key value table according to each resource key value in the resource parameters;
and searching and calling the corresponding non-universal resource file from the non-universal resource file library according to the name of each non-universal resource file as the non-universal resource corresponding to the target webpage.
6. The method for preloading web pages of claim 1, wherein the loading the universal resource to a page display process comprises:
inquiring whether the cache unit stores the universal resource or not;
when the universal resource is not stored in the cache unit, inquiring whether a preset strong cache stores the universal resource or not;
if the universal resource is stored in the strong cache, calling the universal resource from the strong cache to load the universal resource to the page display process.
7. The method for preloading web pages according to claim 6, wherein the querying out the non-universal resource corresponding to the target web page from the cache unit according to the access request and loading the non-universal resource to the page display process comprises:
inquiring whether the cache unit stores the non-universal resource corresponding to the target webpage or not;
when the cache unit does not store the non-universal resource corresponding to the target webpage, inquiring whether the strong cache stores the non-universal resource corresponding to the target webpage or not;
if the non-universal resource corresponding to the target webpage is stored in the strong cache, calling the non-universal resource corresponding to the target webpage from the strong cache and loading the non-universal resource to the page display process.
8. The method for preloading the webpage as claimed in any one of claims 1 to 7, wherein the universal resource is a resource file library formed by respectively summarizing and combining the universal resources for all the webpages of each type of business function by taking a folder as a dimension.
9. The web page preloading method according to any one of claims 1 to 7,
and when the non-universal resource corresponding to the target webpage is not successfully inquired from the non-universal resources, directly downloading the non-universal resource corresponding to the target webpage from the server according to the access request.
10. An apparatus for preloading web pages, the apparatus comprising:
the downloading module is used for inquiring the universal resource and the non-universal resource of the lower-level webpage corresponding to the current webpage from the server, downloading and storing the universal resource and the non-universal resource to a cache unit preset by the browser;
the loading module is used for loading the universal resource to a page display process;
the receiving module is used for receiving an access request of a target webpage triggered by a user based on the current webpage, wherein the target webpage is any lower-level webpage of the current webpage;
the loading module is further configured to query, according to the access request, the non-universal resource corresponding to the target webpage from the cache unit and load the non-universal resource to the page display process;
and the display module is used for mounting the page display progress to display the target page.
11. A computer arrangement, characterized in that the computer arrangement comprises a memory, a processor, the memory having stored thereon a computer program being executable on the processor, the computer program, when being executed by the processor, realizing the steps of the web page preloading method as claimed in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executable by at least one processor to cause the at least one processor to perform the steps of the web page preloading method as recited in any one of claims 1-9.
CN202110008104.7A 2021-01-05 2021-01-05 Webpage preloading method and device and computer equipment Pending CN112612982A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110008104.7A CN112612982A (en) 2021-01-05 2021-01-05 Webpage preloading method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110008104.7A CN112612982A (en) 2021-01-05 2021-01-05 Webpage preloading method and device and computer equipment

Publications (1)

Publication Number Publication Date
CN112612982A true CN112612982A (en) 2021-04-06

Family

ID=75253698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110008104.7A Pending CN112612982A (en) 2021-01-05 2021-01-05 Webpage preloading method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN112612982A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221052A (en) * 2021-05-27 2021-08-06 网易传媒科技(北京)有限公司 Data prefetching method and device, electronic equipment and storage medium
CN113282295A (en) * 2021-05-25 2021-08-20 青岛海尔科技有限公司 Jam processing method and device, storage medium and electronic device
CN114510284A (en) * 2021-12-30 2022-05-17 阿里巴巴(中国)有限公司 Page loading method and device, electronic equipment and readable storage medium
WO2023272858A1 (en) * 2021-06-28 2023-01-05 未鲲(上海)科技服务有限公司 Page resource caching method and apparatus, device, and medium
WO2023134276A1 (en) * 2022-01-12 2023-07-20 腾讯科技(深圳)有限公司 Resource preloading method and apparatus, storage medium, and computer device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015043383A1 (en) * 2013-09-27 2015-04-02 北京奇虎科技有限公司 Webpage loading method and device and browser
CN105760405A (en) * 2014-12-19 2016-07-13 阿里巴巴集团控股有限公司 Methods and devices for obtaining network resource for loading web page and method and device for caching network resource
US20160373545A1 (en) * 2015-06-16 2016-12-22 Guangzhou Ucweb Computer Technology Co., Ltd Method and apparatus for webpage resource acquisition
US20170371974A1 (en) * 2016-06-22 2017-12-28 Guangzhou Ucweb Computer Technology Co., Ltd. Method for loading webpage, client and programmable device
CN110287432A (en) * 2019-06-28 2019-09-27 北京金山安全软件有限公司 Network information processing method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015043383A1 (en) * 2013-09-27 2015-04-02 北京奇虎科技有限公司 Webpage loading method and device and browser
CN105760405A (en) * 2014-12-19 2016-07-13 阿里巴巴集团控股有限公司 Methods and devices for obtaining network resource for loading web page and method and device for caching network resource
US20160373545A1 (en) * 2015-06-16 2016-12-22 Guangzhou Ucweb Computer Technology Co., Ltd Method and apparatus for webpage resource acquisition
US20170371974A1 (en) * 2016-06-22 2017-12-28 Guangzhou Ucweb Computer Technology Co., Ltd. Method for loading webpage, client and programmable device
CN110287432A (en) * 2019-06-28 2019-09-27 北京金山安全软件有限公司 Network information processing method and device and electronic equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282295A (en) * 2021-05-25 2021-08-20 青岛海尔科技有限公司 Jam processing method and device, storage medium and electronic device
CN113282295B (en) * 2021-05-25 2024-02-23 青岛海尔科技有限公司 Blocking processing method and device, storage medium and electronic device
CN113221052A (en) * 2021-05-27 2021-08-06 网易传媒科技(北京)有限公司 Data prefetching method and device, electronic equipment and storage medium
WO2023272858A1 (en) * 2021-06-28 2023-01-05 未鲲(上海)科技服务有限公司 Page resource caching method and apparatus, device, and medium
CN114510284A (en) * 2021-12-30 2022-05-17 阿里巴巴(中国)有限公司 Page loading method and device, electronic equipment and readable storage medium
WO2023134276A1 (en) * 2022-01-12 2023-07-20 腾讯科技(深圳)有限公司 Resource preloading method and apparatus, storage medium, and computer device

Similar Documents

Publication Publication Date Title
CN112612982A (en) Webpage preloading method and device and computer equipment
CN104049986B (en) plug-in loading method and device
CN111444455B (en) Browser compatible method, system, computer device and storage medium
US20150154313A1 (en) A method, device, browser and program for accessing web page
JP2019520624A (en) Page component dynamic layout
CN111639278B (en) Webpage loading method and device
CN107291759B (en) Method and device for processing browser page resources
CN110941779B (en) Page loading method and device, storage medium and electronic equipment
CN112364277A (en) Webpage loading method and device
CN111079048B (en) Page loading method and device
CN115098098A (en) Page generation method, page display method and device
US20230171329A1 (en) Systems and methods for rendering interactive web pages
CN108885544B (en) Front-end page internationalized processing method, application server and computer-readable storage medium
CN114329281A (en) Rendering server, webpage rendering method and webpage rendering device
CN112926002A (en) Service request processing method and device
CN112672187A (en) Page generation method and device and computer equipment
CN114461960B (en) Page generation method, page display method and page display device
CN103258055A (en) Device and method for file downloading
CN112667934A (en) Dynamic simulation diagram display method and device, electronic equipment and computer readable medium
CN116304403A (en) Webpage access method and device, computer equipment and storage medium
CN113934954A (en) Webpage first screen rendering method and device in application program
CN112597423B (en) Webpage content display method, terminal and server
CN114528510A (en) Webpage data processing method and device, electronic equipment and medium
CN112417324A (en) Chrome-based URL (Uniform resource locator) interception method and device and computer equipment
CN113127788A (en) Page processing method, object processing method, device and equipment

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210406

RJ01 Rejection of invention patent application after publication