A network resource loading method and device, electronic equipment and storage medium

By retrieving network resources from multiple cached databases and local databases in parallel on the client side, the problem of high latency in loading network resources on the client side is solved, and a faster network resource loading speed is achieved.

CN116361588BActive Publication Date: 2026-02-06BEIJING IQIYI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211551513.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2026-02-06
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

The client has a high latency in loading network resources, and in existing technologies, it takes a long time for the client to request network resources from the server.

Method used

The client retrieves the target network resource from the first cache database and the second cache database in parallel. If the resource is not found in either of these two databases, it is retrieved from the local database. The cache database and the local database pre-store network resources to ensure that if a resource is cleared from any of the databases, it can be retrieved from other databases.

Benefits of technology

By acquiring network resources in parallel, the latency of client-side network resource loading is reduced, and the speed of acquiring network resources is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116361588B_ABST
    Figure CN116361588B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a network resource loading method and device, electronic equipment and storage medium, and relate to the technical field of Internet, comprising: after receiving an acquisition instruction for a target network resource, obtaining the target network resource from a first cache database and a second cache database of a client in parallel; if the target network resource is obtained from the first cache database or the second cache database, displaying a corresponding target page according to the target network resource; if the target network resource is not obtained from the first cache database and the second cache database, obtaining the target network resource from a local database of the client; after obtaining the target network resource from the local database, displaying a corresponding target page according to the target network resource. Based on the above processing, the delay of the client loading network resources can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet, in particular to a network resource loading method and device, electronic equipment and storage medium. BACKGROUND

[0002] With the rapid development of Internet technology, the functions provided by the client for users are more and more. Users can obtain various network resources such as videos, pictures, texts, etc. through the client. In related technologies, the user can input an acquisition instruction for the network resource to the client. When the client receives the acquisition instruction of the user, the client sends an acquisition request for the network resource indicated by the user to the server. Correspondingly, the server sends the corresponding network resource to the client after receiving the acquisition request. Then, the client displays the corresponding page based on the received network resource.

[0003] However, the time required for the client to request the network resource from the server is relatively long, resulting in a high delay of the client in loading the network resource. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide a network resource loading method, device, electronic equipment and storage medium to reduce the delay of the client in loading the network resource. The specific technical solutions are as follows:

[0005] In the first aspect of the present application, a network resource loading method is first provided, which is applied to a client, and the method comprises:

[0006] After receiving an acquisition instruction for a target network resource, the target network resource is acquired from a first cache database and a second cache database of the client in parallel; wherein the first cache database and the second cache database contain a plurality of network resources pre-stored by the client; the first cache database and the second cache database are different cache areas in the client;

[0007] If the target network resource is acquired from the first cache database or the second cache database, a target page corresponding to the target network resource is displayed according to the target network resource;

[0008] If the target network resource is not acquired from the first cache database and the second cache database, the target network resource is acquired from a local database of the client. After the target network resource is acquired from the local database, a target page corresponding to the target network resource is displayed according to the target network resource; wherein the local database contains a plurality of network resources pre-stored by the client.

[0009] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client; and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0010] The parallel obtaining of the target network resource from the first cache database and the second cache database of the client after receiving the obtaining instruction for the target network resource comprises:

[0011] The forwarding of the obtaining instruction for the target network resource to the Service Worker plug-in through the Webview container after receiving the obtaining instruction for the target network resource through the Webview container comprises:

[0012] The obtaining of the target network resource from the network cache database through the Webview container and the parallel obtaining of the target network resource from the application cache database through the Service Worker plug-in comprise:

[0013] The displaying of the target page corresponding to the target network resource according to the target network resource if the target network resource is obtained from the first cache database or the second cache database comprises:

[0014] The displaying of the target page corresponding to the target network resource according to the target network resource through the Webview container if the target network resource is obtained through the Webview container comprises:

[0015] The returning of the target network resource to the Webview container through the Service Worker plug-in if the target network resource is obtained through the Service Worker plug-in, and the displaying of the target page corresponding to the target network resource according to the target network resource through the Webview container.

[0016] Optionally, the obtaining of the target network resource from the local database of the client comprises:

[0017] The obtaining of the target network resource from the local database of the client through a Native plug-in in the client comprises:

[0018] The displaying of the target page corresponding to the target network resource according to the target network resource after the target network resource is obtained from the local database comprises:

[0019] The returning of the target network resource to the Webview container through the Native plug-in after the target network resource is obtained through the Native plug-in.

[0020] displaying, by the Webview container, a target page corresponding to the target network resource according to the target network resource.

[0021] Optionally, the displaying, by the Webview container, a target page corresponding to the target network resource according to the target network resource comprises:

[0022] creating a blank page by the Webview container;

[0023] rendering, by the Webview container, in the blank page according to the target network resource, to display the target page.

[0024] Optionally, before the acquiring the target network resource from the first cache database and the second cache database of the client in parallel, the method further comprises:

[0025] sending an acquisition request for a target network resource to a server, so that the server sends the target network resource to the client upon receiving the acquisition request;

[0026] after receiving the target network resource sent by the server, storing the target network resource into the first cache database, the second cache database and the local database of the client respectively.

[0027] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client; and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0028] The storing the target network resource into the first cache database, the second cache database and the local database of the client respectively comprises:

[0029] storing, by the Webview container, the target network resource into a network cache database corresponding to the Webview container;

[0030] storing, by the Service Worker plug-in, the target network resource into an application cache database corresponding to the Service Worker plug-in;

[0031] storing, by a Native plug-in in the client, the target network resource into a local database of the client.

[0032] Optionally, before the sending an acquisition request for a target network resource to a server, the method further comprises:

[0033] When detecting a starting instruction input by a user for the client, determine page data of a target page of the client as a target network resource.

[0034] Optionally, before the sending of the request for the target network resource to the server, the method further comprises:

[0035] When detecting a display instruction input by a user for the target page of the client, determine page data of the target page as a target network resource.

[0036] Optionally, after the obtaining of the target network resource from the local database of the client, the method further comprises:

[0037] In a case where the target network resource is not obtained from the local database, send a request for the target network resource to a server, so that the server sends the target network resource to the client upon receiving the request.

[0038] Receive the target network resource sent by the server, and display a target page corresponding to the target network resource according to the target network resource.

[0039] Optionally, after the obtaining of the target network resource from the local database of the client, the method further comprises:

[0040] After the obtaining of the target network resource from the local database, store the target network resource into the first cache database and the second cache database respectively.

[0041] Optionally, the target page is an HTML5 page; and the target network resource comprises a script file of the target page, and pictures and texts displayed in the target page.

[0042] In a second aspect of the present application, a network resource loading device is provided, which is applied to a client and comprises:

[0043] A first obtaining module is configured to, after receiving an obtaining instruction for a target network resource, obtain the target network resource from a first cache database and a second cache database of the client in parallel; the first cache database and the second cache database contain a plurality of network resources pre-stored by the client; and the first cache database and the second cache database are different cache areas in the client.

[0044] The first display module is configured to display a target page corresponding to the target network resource according to the target network resource if the target network resource is obtained from the first cache database or the second cache database.

[0045] The second obtaining module is configured to obtain the target network resource from a local database of the client if the target network resource is not obtained from the first cache database and the second cache database.

[0046] The second display module is configured to display the target page corresponding to the target network resource according to the target network resource after the target network resource is obtained from the local database, wherein the local database contains a plurality of network resources pre-stored by the client.

[0047] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client, and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0048] The first obtaining module is specifically configured to forward the obtaining instruction to the Service Worker plug-in through the Webview container after receiving the obtaining instruction for the target network resource through the Webview container.

[0049] The target network resource is obtained from the network cache database through the Webview container, and the target network resource is obtained from the application cache database through the Service Worker plug-in in parallel.

[0050] The first display module is specifically configured to display the target page corresponding to the target network resource according to the target network resource through the Webview container if the target network resource is obtained through the Webview container.

[0051] If the target network resource is obtained through the Service Worker plug-in, the target network resource is returned to the Webview container through the Service Worker plug-in, and the target page corresponding to the target network resource is displayed through the Webview container according to the target network resource.

[0052] Optionally, the second obtaining module is specifically configured to obtain the target network resource from a local database of the client through a Native plug-in in the client.

[0053] The second display module is specifically configured to return the target network resource to the Webview container through the Native plug-in after the target network resource is acquired through the Native plug-in.

[0054] The target page corresponding to the target network resource is displayed through the Webview container according to the target network resource.

[0055] Optionally, the second display module is specifically configured to create a blank page through the Webview container.

[0056] The target page is displayed through the Webview container by rendering in the blank page according to the target network resource.

[0057] Optionally, the apparatus further comprises:

[0058] The first sending module is configured to send a request for acquiring the target network resource to a server before the first acquiring module performs parallel acquisition of the target network resource from the first cache database and the second cache database of the client, so that the server sends the target network resource to the client when the request is received.

[0059] The first storage module is configured to store the target network resource in the first cache database, the second cache database and the local database of the client respectively after the target network resource sent by the server is received.

[0060] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client, and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0061] The first storage module is specifically configured to store the target network resource in the network cache database corresponding to the Webview container through the Webview container.

[0062] The target network resource is stored in the application cache database corresponding to the Service Worker plug-in through the Service Worker plug-in.

[0063] The target network resource is stored in the local database of the client through the Native plug-in in the client.

[0064] Optionally, the apparatus further comprises:

[0065] The first determining module is configured to determine, as the target network resource, page data of a target page of the client when detecting a user input of a starting instruction for the client before the first sending module sends the request for the target network resource to the server.

[0066] Optionally, the apparatus further comprises:

[0067] The second determining module is configured to determine, as the target network resource, page data of a target page of the client when receiving a user input of a display instruction for the target page of the client before the first sending module sends the request for the target network resource to the server.

[0068] Optionally, the apparatus further comprises:

[0069] The second sending module is configured to send, to the server, a request for the target network resource when the target network resource is not acquired from the local database of the client after the second acquiring module acquires the target network resource from the local database of the client, so that the server sends the target network resource to the client when receiving the request.

[0070] The receiving module is configured to receive the target network resource sent by the server and display a target page corresponding to the target network resource according to the target network resource.

[0071] Optionally, the apparatus further comprises:

[0072] The second storage module is configured to store the target network resource to the first cache database and the second cache database respectively after acquiring the target network resource from the local database of the client after the second acquiring module acquires the target network resource from the local database of the client.

[0073] Optionally, the target page is an HTML5 page, and the target network resource comprises a script file of the target page and pictures and texts displayed in the target page.

[0074] In another aspect of the present application, an electronic device is provided, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus.

[0075] The memory is configured to store a computer program.

[0076] The processor is configured to execute the program stored in the memory to implement the network resource loading method.

[0077] In yet another aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the network resource loading method described above.

[0078] In yet another aspect of the embodiments of the present application, a computer program product is provided, and the computer program product contains instructions, and when the computer program product is run on a computer, the computer is caused to execute the network resource loading method described above.

[0079] The network resource loading method provided by the embodiments of the present application can be used to, after receiving an acquisition instruction for a target network resource, acquire the target network resource from a first cache database and a second cache database of a client in parallel; the first cache database and the second cache database contain a plurality of network resources pre-stored by the client; the first cache database and the second cache database are different cache areas in the client; if the target network resource is acquired from the first cache database or the second cache database, a target page corresponding to the target network resource is displayed according to the target network resource; if the target network resource is not acquired from the first cache database and the second cache database, the target network resource is acquired from a local database of the client; after the target network resource is acquired from the local database, a target page corresponding to the target network resource is displayed according to the target network resource; the local database contains a plurality of network resources pre-stored by the client.

[0080] Based on the above processing, after receiving an acquisition instruction for a target network resource, the target network resource can be acquired from a first cache database and a second cache database in parallel, when the target network resource is acquired, a target page corresponding to the target network resource is displayed according to the target network resource; when the target network resource is not acquired, the target network resource is acquired from a local database, and a target page corresponding to the target network resource is displayed according to the acquired target network resource; since the first cache database, the second cache database and the local database of the client all pre-store network resources, if the network resources stored in one of the databases are cleared, the network resources can also be acquired from other databases; compared with requesting network resources from a server, the time required for acquiring network resources from the first cache database, the second cache database and the local database of the client is shorter, and the delay of loading network resources by the client can be reduced. BRIEF DESCRIPTION OF DRAWINGS

[0081] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced.

[0082] Figure 1 A flowchart of the first network resource loading method provided in the embodiments of the present application;

[0083] Figure 2 a flow chart of a second network resource loading method provided in the embodiments of the present application;

[0084] Figure 3 a flow chart of a third network resource loading method provided in the embodiments of the present application;

[0085] Figure 4 a flow chart of a fourth network resource loading method provided in the embodiments of the present application;

[0086] Figure 5 a flow chart of a fifth network resource loading method provided in the embodiments of the present application;

[0087] Figure 6 a flow chart of a sixth network resource loading method provided in the embodiments of the present application;

[0088] Figure 7 a structural diagram of a database in a client provided in the embodiments of the present application;

[0089] Figure 8 a flow chart of a seventh network resource loading method provided in the embodiments of the present application;

[0090] Figure 9 a structural diagram of a network resource loading apparatus provided in the embodiments of the present application;

[0091] Figure 10 a structural diagram of an electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION

[0092] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0093] In the related art, a user inputs an acquisition instruction for a network resource to a client. The client sends an acquisition request for the network resource indicated by the user to a server after receiving the acquisition instruction. Correspondingly, the server sends the corresponding network resource to the client after receiving the acquisition request. Then, the client displays a corresponding page based on the received network resource. However, the time required for the client to request the network resource from the server is relatively long, resulting in a high delay of the client in loading the network resource.

[0094] To solve the above problems, the embodiment of the present application provides a network resource loading method, which is applied to a client. After receiving an acquisition instruction for a target network resource, the target network resource is acquired from a first cache database and a second cache database of the client in parallel. If the target network resource is acquired from the first cache database or the second cache database, a target page corresponding to the target network resource is displayed according to the target network resource. If the target network resource is not acquired from the first cache database and the second cache database, the target network resource is acquired from a local database of the client. After the target network resource is acquired from the local database, the target page corresponding to the target network resource is displayed according to the target network resource. Since the first cache database, the second cache database and the local database of the client all pre-store network resources, if the network resources stored in one of the databases are cleared, the network resources can still be acquired from other databases. Compared with requesting the network resources from a server, the time required for acquiring the network resources from the first cache database, the second cache database and the local database of the client is short, and the delay of loading the network resources by the client can be reduced.

[0095] Referring to Figure 1 , Figure 1 A flowchart of a network resource loading method provided by the embodiment of the present application is provided, the method is applied to a client, and the method can include the following steps.

[0096] S101: After receiving an acquisition instruction for a target network resource, the target network resource is acquired from a first cache database and a second cache database of the client in parallel.

[0097] The first cache database and the second cache database contain a plurality of network resources pre-stored by the client. The first cache database and the second cache database are different cache areas in the client.

[0098] S102: If the target network resource is acquired from the first cache database or the second cache database, a target page corresponding to the target network resource is displayed according to the target network resource.

[0099] S103: If the target network resource is not acquired from the first cache database and the second cache database, the target network resource is acquired from a local database of the client.

[0100] The local database contains a plurality of network resources pre-stored by the client.

[0101] S104: After the target network resource is acquired from the local database, the target page corresponding to the target network resource is displayed according to the target network resource.

[0102] Based on the network resource loading method provided in the embodiments of the present application, after receiving the acquisition instruction for the target network resource, the target network resource can be acquired from the first cache database and the second cache database in parallel, when the target network resource is acquired, the corresponding target page is displayed according to the target network resource; when the target network resource is not acquired, the target network resource is acquired from the local database, and the corresponding target page is displayed according to the acquired target network resource. Since the network resources are pre-stored in the first cache database, the second cache database and the local database of the client, if the network resources stored in one of the databases are cleared, the network resources can also be acquired from other databases. Compared with requesting the network resources from the server, the time required for acquiring the network resources from the first cache database, the second cache database and the local database of the client is shorter, and the delay of loading the network resources by the client can be reduced.

[0103] For steps S101 and S102, the target network resource can be the page data of the target page of the client, and the target page can be an HTML5 (Hyper Text Markup Language 5, Hyper Text Markup Language) page, referred to as an H5 page. The page data of the target page includes: script text of the target page, such as an HTML file, a CSS (Cascading Style Sheets, Cascading Style Sheets) file, a js (java script, a programming language) file, etc., and page content, pictures and text displayed in the target page.

[0104] The target page can be any page of the client, for example, when the client is a video client, the target page can be a video recommendation page, a video playback page and a video download page of the video client, etc.

[0105] When the user needs to browse the target page of the client, the user can input an acquisition instruction for the target network resource (i.e. the page data of the target page) to the client. For example, when the client is a video client, if the user needs to watch a video, the user can input an acquisition instruction for the page data of the video playback page to the client. Correspondingly, the client can receive the acquisition instruction input by the user.

[0106] The first cache database and the second cache database of the client include a plurality of network resources pre-stored by the client, and the network resources in the first cache database and the second cache database are: stored when the client is started; or stored by the client when the target page is displayed last time. The way in which the client stores the network resources into the first cache database and the second cache database can refer to the related introduction of subsequent embodiments.

[0107] Correspondingly, the client can obtain the target network resource from the first cache database and the second cache database in parallel.

[0108] Further, if the target network resource is obtained from any one of the first cache database or the second cache database, the client can display a target page corresponding to the target network resource in the display interface, and the user can browse the target page displayed by the client. The first cache database and the second cache database of the client are located in different storage locations in the client. Compared with requesting a network resource from a server, the client can obtain a network resource from the first cache database and the second cache database in a shorter time, which can reduce the delay of the client in loading a network resource, and also can reduce the delay of the client in displaying a target page.

[0109] In some embodiments, the first cache database of the client is a network cache database corresponding to a Webview container in the client; and the second cache database of the client is an application cache database corresponding to a Service Worker plug-in in the client.

[0110] Correspondingly, on the basis of Figure 1 , see Figure 2 , step S101 can include the following steps:

[0111] S1011: After receiving the obtaining instruction for the target network resource through the Webview container, forwarding the obtaining instruction to the Service Worker plug-in through the Webview container.

[0112] S1012: Obtaining the target network resource from the network cache database through the Webview container, and obtaining the target network resource from the application cache database through the Service Worker plug-in in parallel.

[0113] Correspondingly, step S102 can include the following steps:

[0114] S1021: If the target network resource is obtained through the Webview container, displaying a target page corresponding to the target network resource according to the target network resource through the Webview container.

[0115] S1022: If the target network resource is obtained through the Service Worker plug-in, returning the target network resource to the Webview container through the Service Worker plug-in.

[0116] S1023: Displaying a target page corresponding to the target network resource according to the target network resource through the Webview container.

[0117] The first cache database of the client is a network cache database corresponding to a Webview container in the client. The Webview container is a program embedded in the client and capable of displaying a page based on WebKit, an open-source browser engine. The network cache database corresponding to the Webview container is a database for writing and reading data through the Webview container.

[0118] The second cache database of the client is an application cache database corresponding to a Service Worker plug-in in the client. The application cache database corresponding to the Service Worker plug-in is a database for writing and reading data through the Service Worker plug-in, for example, an indexDB database. Network resources are stored in the indexDB database in the form of key-value pairs, where the key in the key-value pair is an index of the network resource, and the value in the key-value pair is the network resource.

[0119] The Service Worker plug-in is a program developed based on PAW (Progressive Web Apps) technology. The Service Worker plug-in is equivalent to a proxy service between the Webview container of the client and a server. The Service Worker plug-in can listen to HTTP requests between the Webview container of the client and the server through a fetch event and process the listened HTTP requests. Then, the Service Worker plug-in returns response data of the HTTP requests to the Webview container of the client.

[0120] Since the first cache database and the second cache database of the client each include a plurality of network resources pre-stored by the client, in order to improve the speed of obtaining network resources and reduce the delay of the client in loading network resources, the client can obtain a target network resource from the first cache database and the second cache database in parallel.

[0121] In an implementation, after receiving the fetch instruction for the target network resource through the Webview container, the client forwards the fetch instruction to the Service Worker plug-in through the Webview container. Then, the client can obtain the target network resource from the network cache database through the Webview container, and obtain the target network resource from the application cache database through the Service Worker plug-in in parallel.

[0122] Further, if the client first obtains the target network resource through the Webview container, the client displays the target page in the display interface of the client according to the target network resource through the Webview container. For example, the client creates a blank page in the display interface of the client through the Webview container, and renders the created blank page according to the target network resource through the Webview container to obtain the target page.

[0123] When the client first obtains the target network resource through the Webview container, the client can also stop obtaining the target network resource from the application cache database through the Service Worker plug-in.

[0124] If the client first obtains the target network resource through the Service Worker plug-in, the client returns the target network resource to the Webview container through the Service Worker plug-in. For example, the Service Worker plug-in calls the FetchEvent.respondWith function to return the target network resource to the Webview container. Then, the target page is displayed in the display interface of the client according to the target network resource through the Webview container, and the Webview container stops obtaining the target network resource from the corresponding database.

[0125] Based on the above processing, if the network resource stored in one of the databases is cleared, the network resource can also be obtained from the other database. Compared with requesting the network resource from the server, the time required to obtain the network resource from the first cache database and the second cache database of the client is shorter, which can reduce the delay of the client in loading the network resource. Moreover, since the first cache database and the second cache database of the client each include a plurality of network resources pre-stored by the client, the client can obtain the network resource from the first cache database and the second cache database in parallel through the Webview container and the Service Worker plug-in, which can improve the speed of obtaining the network resource and further reduce the delay of the client in loading the network resource.

[0126] If the target network resource is not acquired from the first cache database and the second cache database of the client, it indicates that the target network resource is not stored in the first cache database and the second cache database of the client. Then, the client can acquire the target network resource from the local database. If the target network resource is acquired from the local database, the client can display the target page corresponding to the target network resource according to the target network resource.

[0127] In some embodiments, based on Figure 2 , see Figure 3 , step S103 can include the following steps:

[0128] S1031: acquiring the target network resource from the local database of the client through the Native plug-in in the client.

[0129] Correspondingly, step S104 can include the following steps:

[0130] S1041: after acquiring the target network resource through the Native plug-in, returning the target network resource to the Webview container through the Native plug-in.

[0131] S1042: displaying the target page corresponding to the target network resource according to the target network resource through the Webview container.

[0132] The local database of the client can be a file manager in the operating system of the client, for example, a file manager of an Android operating system or a file manager of a Linux operating system.

[0133] The Native plug-in in the client is a program built in the client and running based on the operating system of the client. The client can write and read data in the file manager in the operating system of the client through the Native plug-in.

[0134] If the target network resource is not acquired from the first cache database and the second cache database of the client, the client forwards the acquisition instruction for the target network resource to the Native plug-in through the Webview container. Correspondingly, the client acquires the storage path of the target network resource through the Native plug-in and acquires the target network resource from the file manager in the operating system of the client according to the storage path. If the target network resource is acquired through the Native plug-in, the client returns the target network resource to the Webview container through the Native plug-in. Further, the client displays the target page in the display interface of the client according to the target network resource through the Webview container.

[0135] In some embodiments, step S1042 can include the following steps:

[0136] Step 1, creating a blank page through the Webview container.

[0137] Step 2, rendering in the blank page according to the target network resource through the Webview container to display the target page.

[0138] The client creates a blank page in the display interface of the client through the Webview container, and renders in the created blank page according to the target network resource through the Webview container to obtain the target page.

[0139] Based on the above processing, the first cache database and the second cache database of the client and the local database are located in different storage locations of the client locally. Since the local database of the client includes a plurality of network resources stored in advance by the client, when the target network resource is not stored in the first cache database and the second cache database of the client, the client can obtain the network resource from the local database through the Native plug-in, which can improve the speed of obtaining the network resource and reduce the delay of loading the network resource by the client.

[0140] In some embodiments, after step S103, the method can further include the following steps: after obtaining the target network resource from the local database, storing the target network resource into the first cache database and the second cache database respectively.

[0141] If the client obtains the target network resource through the Native plug-in, it indicates that the target network resource is stored in the local database of the client, but the target network resource is not stored in the first cache database and the second cache database of the client. Accordingly, the client can store the target network resource into the first cache database and the second cache database of the client respectively. For example, the client returns the target network resource to the Webview container through the Native plug-in, stores the target network resource into the network cache database through the Webview container, and returns the target network resource to the Service Worker plug-in through the Native plug-in, and stores the target network resource into the application cache database through the Service Worker plug-in.

[0142] Subsequently, when the client receives the obtaining instruction for the target network resource again, the client can obtain the target network resource from the network cache database and the application cache database through the Webview container and the Service Worker plug-in in a parallel processing manner, which can improve the speed of obtaining the network resource and further reduce the delay of loading the network resource by the client.

[0143] In some embodiments, on the basis of Figure 1 Referring to Figure 4 After step S104, the method can further include the following steps:

[0144] S105: In the case that the target network resource is not acquired from the local database, sending an acquisition request for the target network resource to the server, so that the server sends the target network resource to the client upon receiving the acquisition request.

[0145] S106: Receiving the target network resource sent by the server, and displaying a target page corresponding to the target network resource according to the target network resource.

[0146] If the target network resource is not acquired from the local database of the client, it indicates that the target network resource is not stored in the first cache database, the second cache database and the local database of the client, that is, the target network resource is not stored locally in the client. Therefore, the client can send an acquisition request for the target network resource to the server. Correspondingly, the server sends the target network resource to the client upon receiving the acquisition request. Further, the client displays a target page in the display interface of the client upon receiving the target network resource sent by the server.

[0147] Then, the client can store the target network resource into the first cache database, the second cache database and the local database of the client respectively. Subsequently, upon receiving an acquisition instruction for the target network resource again, the client can acquire the target network resource from the first cache database, the second cache database and the local database of the client respectively, which can improve the acquisition speed of the network resource and further reduce the delay of loading the network resource by the client.

[0148] In some embodiments, the client can store the network resource into the first cache database, the second cache database and the local database of the client in the following manner.

[0149] Correspondingly, on the basis of Figure 1 Referring to Figure 5 Before step S101, the method can include the following steps:

[0150] S107: Sending an acquisition request for the target network resource to the server, so that the server sends the target network resource to the client upon receiving the acquisition request.

[0151] S108: Storing the target network resource into the first cache database, the second cache database and the local database of the client respectively upon receiving the target network resource sent by the server.

[0152] The target network resource can be page data of a target page of the client.

[0153] In an implementation, the target page can be a specified page in the client. For example, the client is a video client, and the target page can include a home page of the video client and pages associated with the home page. For example, the home page includes an operation button for accessing a video recommendation page and an operation button for accessing a video playing page, and the pages associated with the home page include the video recommendation page and the video playing page.

[0154] Correspondingly, before step S107, the method can further include the following step: determining, as the target network resource, page data of a target page of the client when detecting a start instruction for the client input by the user.

[0155] When the user needs to obtain a network resource, the user can start the client. Correspondingly, when detecting a start instruction for the client, it indicates that the user can need to browse a target page of the client, and the client can determine page data of the target page as the target network resource to be obtained.

[0156] For example, the client is a video client, and when detecting that the user opens the video client, it indicates that the user can need to browse a home page of the client and pages associated with the home page. The video client can determine, as the target network resource, page data of the home page and page data of the pages associated with the home page.

[0157] Based on the above processing, when the user starts the client, the target network resource (i.e., page data of a target page of the client) can be determined, and the target network resource obtained from the server can be stored in the first cache database, the second cache database, and the local database of the client. That is, the client can proactively store the target network resource in the first cache database, the second cache database, and the local database of the client before loading the target page. Subsequently, the client can obtain the network resource from the first cache database, the second cache database, and the local database of the client after receiving an obtaining instruction for the target network resource, which can reduce the delay of the client in loading the network resource compared with requesting the network resource from the server.

[0158] In another implementation, the target page can be a page that the user needs to browse this time. Correspondingly, before step S107, the method can further include the following step: determining, as the target network resource, page data of a target page of the client when receiving a display instruction for the target page of the client input by the user.

[0159] While browsing a client's webpage, a user may need to view the client's target page. Accordingly, the user can input a display command for the target page into the client. Upon receiving a display command for the target page, it indicates that the user needs to view the client's target page, and the client can then determine that the page data of the target page is the desired network resource.

[0160] Based on the above processing, during the loading of the target page, the target network resources obtained from the server can be stored in the client's first cache database, second cache database, and local database. Subsequently, when the client receives another instruction to retrieve the target network resources, it can retrieve the network resources from the client's first cache database, second cache database, and local database. Compared to the client requesting the target network resources from the server every time, this saves bandwidth resources and ensures the effective utilization of network resources. This reduces the latency of loading target network resources on the client, improves the user experience of browsing the target page, and ultimately enhances the user experience of using the client.

[0161] Furthermore, the client can send a request to the server for a target network resource, and in return, the server can send the target network resource to the client. For example, the client can send an HTTP request for a target network resource to the server through a WebView container. After receiving the HTTP request, the server returns the target network resource to the WebView container in the client.

[0162] Since users may browse the target page multiple times, the client needs to repeatedly load the target network resource. Each time, the client passively loads the network resource from the server; that is, the client only loads the user-indicated target network resource when it receives a user's request. This results in high latency in loading the target page, leading to longer periods of blank space on the client's screen and a degraded user experience. To reduce this latency, after receiving the target network resource from the server, the client can store it in its first cache database, second cache database, and local database.

[0163] In some embodiments, the first cache database is the network cache database corresponding to the Webview container in the client; the second cache database is the application cache database corresponding to the Service Worker plugin in the client.

[0164] Correspondingly, in Figure 5 Based on this, see Figure 6 Step S108 may include the following steps:

[0165] S1081: After receiving the target network resource sent by the server, the target network resource is stored into the network cache database corresponding to the Webview container through the Webview container.

[0166] S1082: The target network resource is stored into the application cache database corresponding to the Service Worker plug-in through the Service Worker plug-in.

[0167] S1083: The target network resource is stored into the local database of the client through the Native plug-in in the client.

[0168] In an implementation manner, the client can send an acquisition request for the target network resource to the server through the Webview container, and the acquisition request can be an HTTP request. When the server receives the acquisition request, the server can return response data (i.e., the target network resource) of the acquisition request to the Webview container of the client. Correspondingly, the client can receive the target network resource sent by the server through the Webview container, and store the target network resource into the network cache database corresponding to the Webview container through the Webview container.

[0169] The client can also listen to the target network resource returned by the server to the Webview container of the client through the Service Worker plug-in, and store the target network resource into the application cache database corresponding to the Service Worker plug-in through the Service Worker plug-in. For example, the Service Worker plug-in stores the target network resource and the corresponding index into the application cache database corresponding to the Service Worker plug-in in the form of key-value, by taking the index of the target network resource as the key and taking the target network resource as the value.

[0170] The client can also listen to the target network resource returned by the server to the Webview container of the client through the Native plug-in, and store the target network resource into the local database of the client through the Native plug-in. The local database of the client can be a file manager in the operating system of the client. For example, the Native plug-in stores the target network resource into the directory corresponding to the storage path in the file manager of the operating system according to the corresponding storage path.

[0171] Since the cache settings of the network resources in the network cache database of the client are relatively messy, the network resources in the network cache database can not be retained for a long time and can be cleared by other security software, and the compatibility of the application cache database of the client is relatively low, so that the stored network resources are less. If the target network resource is only stored in one of the databases, when the client receives the acquisition instruction for the target network resource again, if the target network resource is not stored in the database, the client still needs to request the target network resource from the server, so that the delay of the client loading the target page is high.

[0172] Correspondingly, after obtaining the target network resource from the server, the client stores the target network resource into the first cache database, the second cache database and the local database of the client. Subsequently, when the client receives the acquisition instruction for the target network resource again, if the network resource stored in one of the databases is cleared, the network resource can also be obtained from the other databases. Compared with requesting the network resource from the server, the time required for obtaining the network resource from the first cache database, the second cache database and the local database of the client is short, and the delay of the client loading the network resource can be reduced.

[0173] In some embodiments, when the target page can be the page that the user needs to browse this time, the client can also display the corresponding target page in the display interface according to the received target network resource after receiving the target network resource sent by the server.

[0174] Referring to Figure 7 , Figure 7 A structural diagram of a database in a client is provided for the embodiments of the application.

[0175] The client includes a network cache database corresponding to a Webview container, an application cache database corresponding to a Service Worker plug-in, and a local database corresponding to a Native plug-in. The Webview container obtains network resources by sending an HTTP request to a server and stores the obtained network resources into the network cache database, so the network cache database can also be called HTTP Cache (HyperText Transfer Protocol Cache). The Service Worker plug-in is a plug-in built in the client (for example, an application program), and the application cache database can be called APP Cache (Application Program Cache). The local database is a file manager of the operating system of the client, and the local database can be called Local (Local) database.

[0176] The network cache database, the application cache database and the local database are databases of the client, and the network cache database, the application cache database and the local database are located at different storage locations of the client. After the target network resource is acquired from the server, the target network resource can be stored in the network cache database, the application cache database and the local database of the client.

[0177] Subsequently, after receiving the acquisition instruction for the target network resource, the client can acquire the target network resource from the network cache database and the application cache database in a parallel processing manner. If the target network resource is acquired from the network cache database or the application cache database, the target page corresponding to the target network resource is displayed on the client.

[0178] If the target network resource is not acquired from the network cache database and the application cache database of the client, the target network resource is acquired from the local database of the client. Then, after the target network resource is acquired from the local database of the client, the target page corresponding to the target network resource is displayed on the display interface of the client. After the target network resource is acquired from the local database of the client, the target network resource can be stored in the network cache database and the application cache database of the client.

[0179] Based on the above processing, the target network resource acquired from the server is stored in the network cache database, the application cache database and the local database of the client. The stability of the client storage and the efficiency of the client loading network resource are fully utilized, and the network resource is loaded in advance. Subsequently, after the client receives the acquisition instruction for the target network resource again, the network resource can be acquired from the network cache database, the application cache database and the local database of the client. The delay of the client loading network resource can be reduced, the loading speed of the network resource is greatly improved, that is, the opening time of the target page can be reduced, and the user experience is improved. Furthermore, compared with the client requesting the target network resource from the server every time, the network resource overhead of the client can be reduced, the bandwidth resource can be saved, the effective use of the network resource is ensured, the delay of the client loading the target network resource is reduced, the user experience of the user browsing the target page is improved, and the user experience of the user using the client is improved.

[0180] Referring to Figure 8 , Figure 8 A flowchart of a network resource loading method provided by an embodiment of the application. Figure 8 The application program in the client is the client in the foregoing embodiment, the browser is a browser plug-in (Webview container) embedded in the client, and the network request interface is an interface for network communication between the client and other devices.

[0181] After the client receives the obtaining instruction for the target network resource corresponding to the target page through the Webview container, the client forwards the obtaining instruction to the Service Worker plug-in through the Webview container. Then, the client obtains the target network resource from the network cache database of the client through the Webview container, and obtains the target network resource from the application cache database of the client through the Service Worker plug-in. If the target network resource is obtained from the network cache database or the application cache database of the client, the client displays the target page corresponding to the target network resource in the display interface.

[0182] If the target network resource is not obtained from the network cache database and the application cache database of the client, the client forwards the obtaining instruction to the Native plug-in through the Webview container. Then, the client obtains the target network resource from the local database of the client through the Native plug-in. If the target network resource is obtained from the local database of the client, the target page corresponding to the target network resource is displayed in the display interface of the client. After the target network resource is obtained from the local database of the client, the client can also store the target network resource in the network cache database and the application cache database of the client, respectively.

[0183] If the target network resource is not obtained from the local database of the client, the client sends an HTTP request for the target network resource to the server through the Webview container, so as to load the target network resource from the server. Specifically, the client sends the HTTP request to the network request interface of the client through the network proxy (English: NetworkProxy) through the Webview container, and sends the HTTP request to the server through the network request interface of the client.

[0184] Correspondingly, after the server receives the HTTP request for the target network resource, the server returns the target network resource to the Webview container in the client through the network request interface of the client. Correspondingly, the client receives the target network resource through the Webview container, and stores the target network resource in the network cache database through the Webview container.

[0185] The client can also listen to the target network resource returned by the server to the Webview container of the client through the Service Worker plug-in, and store the target network resource in the application cache database through the Service Worker plug-in. The client can also listen to the target network resource returned by the server to the Webview container of the client through the Native plug-in, and store the target network resource in the local database of the client through the Native plug-in.

[0186] The client can also communicate with a publishing platform, and when a network resource is updated, the publishing platform actively pushes the updated information of the network resource to the client. Correspondingly, after receiving the updated information, the client can acquire the updated network resource according to the updated information.

[0187] Based on the above processing, the target network resource acquired from the server is stored in the network cache database, the application cache database and the local database of the client, the stability of the storage of the client and the high efficiency of the loading of the network resource of the client are fully utilized, and the loading of the network resource in advance is realized. After receiving the acquisition instruction for the target network resource again, the client can acquire the network resource from the network cache database, the application cache database and the local database of the client, the delay of the loading of the network resource of the client can be reduced, the loading speed of the network resource is greatly improved, that is, the opening time of the target page can be reduced, and the user experience is improved. Moreover, compared with the case that the client requests the target network resource from the server each time, the network resource overhead of the client can be reduced, the bandwidth resource is saved, the effective utilization of the network resource is ensured, the delay of the loading of the target network resource of the client is reduced, the user experience of the user browsing the target page is improved, and the user experience of the user using the client is improved.

[0188] With Figure 1 corresponding to the method embodiment, refer to Figure 9 , Figure 9 a structure diagram of a network resource loading device provided by the embodiment of the application, the device is applied to a client, and the device comprises:

[0189] The first acquisition module 901 is configured to acquire the target network resource from the first cache database and the second cache database of the client in parallel after receiving the acquisition instruction for the target network resource; the first cache database and the second cache database contain a plurality of network resources pre-stored by the client; and the first cache database and the second cache database are different cache areas in the client.

[0190] The first display module 902 is configured to display the target page corresponding to the target network resource according to the target network resource if the target network resource is acquired from the first cache database or the second cache database.

[0191] The second acquisition module 903 is configured to acquire the target network resource from the local database of the client if the target network resource is not acquired from the first cache database and the second cache database.

[0192] The second display module 904 is configured to display a target page corresponding to the target network resource according to the target network resource after the target network resource is obtained from the local database.

[0193] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client, and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0194] The first obtaining module 901 is specifically configured to forward the obtaining instruction to the Service Worker plug-in through the Webview container after the obtaining instruction for a target network resource is received through the Webview container.

[0195] The target network resource is obtained from the network cache database through the Webview container, and the target network resource is obtained from the application cache database through the Service Worker plug-in in parallel.

[0196] The first display module 902 is specifically configured to display a target page corresponding to the target network resource according to the target network resource through the Webview container if the target network resource is obtained through the Webview container.

[0197] If the target network resource is obtained through the Service Worker plug-in, the target network resource is returned to the Webview container through the Service Worker plug-in, and a target page corresponding to the target network resource is displayed according to the target network resource through the Webview container.

[0198] Optionally, the second obtaining module 903 is specifically configured to obtain the target network resource from a local database of the client through a Native plug-in in the client.

[0199] The second display module 904 is specifically configured to return the target network resource to the Webview container through the Native plug-in after the target network resource is obtained through the Native plug-in.

[0200] A target page corresponding to the target network resource is displayed according to the target network resource through the Webview container.

[0201] Optionally, the second display module 904 is specifically configured to create a blank page through the Webview container.

[0202] The target page is rendered in the blank page according to the target network resource through the Webview container.

[0203] Optionally, the apparatus further comprises:

[0204] The first sending module is configured to send a request for the target network resource to a server before the first obtaining module 902 obtains the target network resource from the first cache database and the second cache database of the client in parallel, so that the server sends the target network resource to the client when the request is received.

[0205] The first storage module is configured to store the target network resource in the first cache database, the second cache database and the local database of the client respectively after the target network resource sent by the server is received.

[0206] Optionally, the first cache database is a network cache database corresponding to a Webview container in the client; and the second cache database is an application cache database corresponding to a Service Worker plug-in in the client.

[0207] The first storage module is specifically configured to store the target network resource in the network cache database corresponding to the Webview container through the Webview container.

[0208] The target network resource is stored in the application cache database corresponding to the Service Worker plug-in through the Service Worker plug-in.

[0209] The target network resource is stored in the local database of the client through the Native plug-in in the client.

[0210] Optionally, the apparatus further comprises:

[0211] The first determination module is configured to determine the page data of the target page of the client as the target network resource when detecting a user input of a start instruction for the client before the first sending module sends the request for the target network resource to the server.

[0212] Optionally, the apparatus further comprises:

[0213] The second determining module is configured to, before the first sending module sends the request for the target network resource to the server, determine page data of a target page as the target network resource when receiving a display instruction for the target page input by a user.

[0214] Optionally, the apparatus further comprises:

[0215] The second sending module is configured to, after the second obtaining module 903 obtains the target network resource from the local database of the client, send a request for the target network resource to the server in a case where the target network resource is not obtained from the local database, so that the server sends the target network resource to the client when receiving the request.

[0216] The receiving module is configured to receive the target network resource sent by the server, and display the target page corresponding to the target network resource according to the target network resource.

[0217] Optionally, the apparatus further comprises:

[0218] The second storage module is configured to, after the second obtaining module 903 obtains the target network resource from the local database of the client, store the target network resource to the first cache database and the second cache database respectively after obtaining the target network resource from the local database.

[0219] Optionally, the target page is an HTML5 page, and the target network resource comprises a script file of the target page, and pictures and texts displayed in the target page.

[0220] According to the network resource loading apparatus provided by the embodiment of the present application, after receiving the request for the target network resource, the target network resource can be obtained from the first cache database and the second cache database in parallel, and when the target network resource is obtained, the corresponding target page is displayed according to the target network resource; when the target network resource is not obtained, the target network resource is obtained from the local database, and the corresponding target page is displayed according to the obtained target network resource. Since the network resource is stored in the first cache database, the second cache database and the local database of the client in advance, if the network resource stored in one of the databases is cleared, the network resource can be obtained from the other databases. Compared with requesting the network resource from the server, the time required for obtaining the network resource from the first cache database, the second cache database and the local database of the client is short, and the delay of loading the network resource by the client can be reduced.

[0221] The embodiment of the present application further provides an electronic device, which comprises the network resource loading apparatus.Figure 10 As shown, the electronic device includes a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004,

[0222] The memory 1003 is used to store a computer program.

[0223] The processor 1001 is used to execute the program stored in the memory 1003 to implement the following steps:

[0224] After receiving the acquisition instruction for the target network resource, the target network resource is acquired from the first cache database and the second cache database of the client in parallel; wherein the first cache database and the second cache database contain a plurality of network resources pre-stored by the client; the first cache database and the second cache database are different cache areas in the client;

[0225] If the target network resource is acquired from the first cache database or the second cache database, the target page corresponding to the target network resource is displayed according to the target network resource;

[0226] If the target network resource is not acquired from the first cache database and the second cache database, the target network resource is acquired from the local database of the client; after the target network resource is acquired from the local database, the target page corresponding to the target network resource is displayed according to the target network resource; wherein the local database contains a plurality of network resources pre-stored by the client.

[0227] The communication bus mentioned in the above electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0228] The communication interface is used for communication between the above electronic device and other devices.

[0229] The memory can include a random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.

[0230] The processor described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0231] In yet another embodiment provided by the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the network resource loading method in any of the above embodiments.

[0232] In yet another embodiment provided by the present application, a computer program product containing instructions, which, when run on a computer, causes the computer to execute the network resource loading method in any of the above embodiments.

[0233] In the embodiments described above, all or some of the steps can be implemented by software, hardware or firmware, or any combination thereof. When implemented by software, all or some of the steps can be implemented in the form of one or more computer programs. The computer program can be stored in any computer readable medium, and loaded into the computer for execution. The computer readable medium includes computer storage media and communication media. The computer storage media includes any tangible or physical medium for storing or transmitting the program. The computer storage media can be a volatile (such as RAM) or non-volatile (such as ROM, disk, or CD) storage medium. The communication media typically include computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and includes any information delivery media. The computer readable medium can be a computer program product.

[0234] It should be noted that, in this document, the terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Also, the terms "comprises", "comprising", or any other variations thereof are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements does not only include those elements, but also includes other elements not expressly listed, or other elements inherent in such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0235] Each of the embodiments in the specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the device, electronic device, computer readable storage medium and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

[0236] The above merely provides the preferred embodiments of the application, and not intended to limit the protection scope of the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall fall within the protection scope of the application.

Claims

1. A method for loading network resources, characterized in that, The method is applied to a client, and the method includes: Upon receiving a command to acquire a target network resource, the target network resource is acquired in parallel from the first cache database and the second cache database of the client; wherein the first cache database and the second cache database contain multiple network resources pre-stored by the client; the first cache database and the second cache database are different cache areas in the client; If the target network resource is obtained from the first cache database or the second cache database, the target page corresponding to the target network resource is displayed according to the target network resource; If the target network resource is not found in either the first cache database or the second cache database, the target network resource is retrieved from the client's local database. After retrieving the target network resource from the local database, the target page corresponding to the target network resource is displayed. The local database contains multiple network resources pre-stored by the client. The first cache database is the network cache database corresponding to the Webview container in the client; the second cache database is the application cache database corresponding to the Service Worker plugin in the client. Upon receiving an instruction to acquire a target network resource, the step of acquiring the target network resource in parallel from the client's first cache database and second cache database includes: After receiving a request for a target network resource through the Webview container, the request is forwarded to the Service Worker plugin through the Webview container. The target network resource is obtained from the network cache database through the Webview container, and the target network resource is also obtained from the application cache database in parallel through the Service Worker plugin; If the target network resource is obtained from the first cache database or the second cache database, displaying the target page corresponding to the target network resource according to the target network resource includes: If the target network resource is obtained through the Webview container, the target page corresponding to the target network resource is displayed through the Webview container according to the target network resource; If the target network resource is obtained through the Service Worker plugin, the target network resource is returned to the Webview container through the Service Worker plugin; the target page corresponding to the target network resource is displayed through the Webview container according to the target network resource.

2. The method according to claim 1, characterized in that, The step of obtaining the target network resource from the client's local database includes: The target network resource is obtained from the client's local database through the native plugin in the client. After obtaining the target network resource from the local database, the step of displaying the target page corresponding to the target network resource includes: After obtaining the target network resource through the Native plugin, the target network resource is returned to the Webview container through the Native plugin; The Webview container displays the target page corresponding to the target network resource according to the target network resource.

3. The method according to claim 2, characterized in that, The step of displaying the target page corresponding to the target network resource through the Webview container according to the target network resource includes: A blank page is created using the Webview container; The target web resource is rendered in the blank page using the Webview container to display the target page.

4. The method according to claim 1, characterized in that, Before the parallel retrieval of the target network resource from the first cache database and the second cache database of the client, the method further includes: Send a request to the server for the target network resource, so that when the server receives the request, it sends the target network resource to the client; After receiving the target network resources sent by the server, the target network resources are stored in the client's first cache database, second cache database, and local database, respectively.

5. The method according to claim 4, characterized in that, The first cache database is the network cache database corresponding to the Webview container in the client; the second cache database is the application cache database corresponding to the ServiceWorker plugin in the client. The step of storing the target network resources into the client's first cache database, second cache database, and local database respectively includes: The target network resource is stored in the network cache database corresponding to the Webview container through the Webview container; The target network resources are stored in the application cache database corresponding to the Service Worker plugin through the Service Worker plugin. The target network resources are stored in the client's local database via a native plugin.

6. The method according to claim 4, characterized in that, Before sending the request to the server for the target network resource, the method further includes: When a user inputs a launch command for the client, the page data of the target page of the client is determined as the target network resource.

7. The method according to claim 4, characterized in that, Before sending the request to the server for the target network resource, the method further includes: When a user inputs a display instruction for a target page on the client, the page data of the target page is determined and used as the target network resource.

8. The method according to claim 1, characterized in that, After obtaining the target network resource from the client's local database, the method further includes: If the target network resource is not obtained from the local database, a request to obtain the target network resource is sent to the server, so that the server sends the target network resource to the client upon receiving the request. Receive the target network resource sent by the server, and display the target page corresponding to the target network resource according to the target network resource.

9. The method according to claim 1, characterized in that, After obtaining the target network resource from the client's local database, the method further includes: After obtaining the target network resources from the local database, the target network resources are stored in the first cache database and the second cache database, respectively.

10. The method according to claim 1, characterized in that, The target page is an HTML5 page; the target network resources include: the script file of the target page, and the images and text displayed on the target page.

11. A network resource loading device, characterized in that, The device is used on a client side, and the device includes: The first acquisition module is configured to, upon receiving an acquisition instruction for a target network resource, acquire the target network resource in parallel from a first cache database and a second cache database of the client; wherein the first cache database and the second cache database contain multiple network resources pre-stored by the client; and the first cache database and the second cache database are different cache areas in the client; The first display module is configured to, if the target network resource is obtained from the first cache database or the second cache database, display the target page corresponding to the target network resource according to the target network resource; The second acquisition module is used to acquire the target network resource from the client's local database if the target network resource is not acquired from either the first cache database or the second cache database. The second display module is used to display the target page corresponding to the target network resource after obtaining the target network resource from the local database; wherein, the local database contains multiple network resources pre-stored by the client; The first cache database is the network cache database corresponding to the Webview container in the client; the second cache database is the application cache database corresponding to the Service Worker plugin in the client. The first acquisition module is specifically used to forward the acquisition instruction for the target network resource to the Service Worker plugin through the Webview container after receiving the acquisition instruction for the target network resource through the Webview container; The target network resource is obtained from the network cache database through the Webview container, and the target network resource is also obtained from the application cache database in parallel through the Service Worker plugin; The first display module is specifically used to, if the target network resource is obtained through the Webview container, display the target page corresponding to the target network resource through the Webview container according to the target network resource; If the target network resource is obtained through the Service Worker plugin, the target network resource is returned to the Webview container through the Service Worker plugin; the target page corresponding to the target network resource is displayed through the Webview container according to the target network resource.

12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-10.

Citation Information

Patent Citations

  • Method and device for guaranteeing high availability of application page of mobile terminal

    CN115391698A