A webpage resource access method, device, terminal and storage medium

Through offline cache and WebView container hijacking technology, Hybrid App has solved the problem of stuttering problems at the limited time of the network speed and the difficulty of access to web resources under offline conditions, and improved access efficiency and local experience.

CN113111282BActive Publication Date: 2025-01-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010033727.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-13
Publication Date
2025-01-28
Estimated Expiration
2040-01-13

AI Technical Summary

Technical Problem

When the network speed of Hybrid App is limited, accessing web page resources will be stuck or stuck, and it will not be able to access web page resources offline, affecting user interaction and local experience.

Method used

Through offline cache web access resources, and when receiving access requests, we use the WebView container to hijack the unified resource positioning symbol to load local offline subcontracting resources to achieve offline access to web resources.

Benefits of technology

The Hybrid APP's access efficiency of web resources has been improved, the local experience is strengthened, the phenomenon of stuttering at a limited time is avoided, and the access of web resources is realized in offline conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113111282B_ABST
    Figure CN113111282B_ABST
Patent Text Reader

Abstract

The present application discloses a webpage resource access method, device, terminal and storage medium. When the method detects a resource update signal, it downloads sub-package resources corresponding to updateable webpage resources to obtain offline sub-package resources; when an access request is received, it adds a sub-package identifier to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-package identifier is used to enable a webpage view container to hijack the uniform resource locator to be accessed; when the webpage view container hijacks the uniform resource locator to be accessed and the corresponding offline sub-package resource is the latest version, the corresponding offline sub-package resource is loaded according to the scope of the uniform resource locator to be accessed; the method realizes offline access to webpage resources by offline loading the local sub-package resource corresponding to the uniform resource locator to be accessed, improves the access efficiency of webpage resources, and enhances the local experience of hybrid mode applications; and the updateable webpage resources are downloaded by sub-packaging, so as to improve the success rate of resource downloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a web resource access method, device, terminal and storage medium. Background Art

[0002] The feature of Hybrid App (hybrid mode application) is that a browser is built into the App, so that some functional pages can be presented in the form of web pages, that is, the corresponding functions in the App are implemented by accessing web resources (i.e. web resources) online. It is precisely because some functions in Hybrid App can only be implemented by accessing web resources online. Therefore, when the network speed of HybridApp is limited, online access to web resources will be stuck or jammed, which affects the interaction with the user, increases its instability, and reduces the local experience of HybridApp. Therefore, how to improve the efficiency of HybridApp in accessing web resources is a technical problem that technicians in this field need to solve. Summary of the invention

[0003] In view of this, the present application provides a web resource access method, device, terminal and storage medium, which first caches the resources that web access depends on offline, and then loads the local offline sub-package resources corresponding to the uniform resource locator to be accessed offline, so as to realize offline access to web resources, improve the access efficiency of Hybrid App to web resources, and enhance the local experience of HybridApp; and web resources can be updated through sub-package download, which improves the success rate of web resource download.

[0004] To achieve the above objectives, on the one hand, the present application provides a web resource access method, comprising:

[0005] When a resource update signal is detected, the sub-package resources corresponding to the updateable web page resources are downloaded to obtain offline sub-package resources;

[0006] When receiving an access request, a sub-packaging identifier is added to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed;

[0007] When the web page view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version, the corresponding offline sub-package resource is loaded according to the scope of the uniform resource locator to be accessed.

[0008] In a possible implementation manner, adding a sub-packet identifier to a uniform resource locator corresponding to the access request includes:

[0009] Add a query parameter at the end of the uniform resource locator corresponding to the access request.

[0010] In another possible implementation, if the offline sub-package resource corresponding to the to-be-accessed uniform resource locator in the web page view container is not the latest version, it includes:

[0011] Determining whether there is an online backup uniform resource locator in the uniform resource locator to be accessed;

[0012] If it exists, then requesting the online backup uniform resource locator online;

[0013] If it does not exist, then an online request is made for the uniform resource locator to be accessed.

[0014] In yet another possible implementation manner, before the resource update signal is detected, the method further includes:

[0015] Download update information corresponding to updateable web resources;

[0016] Determining whether the updateable webpage resource is the latest version of the webpage resource according to the update information;

[0017] If so, a resource update signal is generated.

[0018] In another possible implementation, the downloading of sub-package resources corresponding to the updateable webpage resources includes:

[0019] Downloading subpackage resources corresponding to the updateable webpage resources from the resource server; the subpackage resources are resource compression packages containing corresponding directory information;

[0020] Correspondingly, the loading of the corresponding offline sub-package resource according to the scope of the to-be-accessed uniform resource locator includes:

[0021] Determining the directory information corresponding to the scope of the uniform resource locator to be accessed from the directory information corresponding to all offline sub-package resources to obtain the target directory information;

[0022] Load the offline sub-package resources corresponding to the target directory information.

[0023] In another possible implementation, the downloading of update information corresponding to the updateable webpage resource and the downloading of sub-package resources corresponding to the updateable webpage resource include:

[0024] The update information and the sub-package resources corresponding to the updateable web page resources are downloaded through a security gateway.

[0025] In yet another possible implementation, obtaining the offline sub-packet resource includes:

[0026] Determine whether the sub-packaging type of the sub-packaging resource is an incremental package;

[0027] If it is not an incremental package, decompress and replace the sub-package resources to form offline sub-package resources;

[0028] If it is an incremental package, merge the subpackage resources into the locally solidified subpackage resources, and determine whether the merging is successful;

[0029] If the merge is successful, the merged subpackage resources are decompressed and replaced to form offline subpackage resources;

[0030] If the merging fails, the sub-package type is changed to a whole package, and the whole package resource corresponding to the sub-package resource is downloaded.

[0031] In another aspect, the present application provides a web resource access device, comprising:

[0032] The webpage resource download module is used to download the sub-package resources corresponding to the updateable webpage resources when a resource update signal is detected, so as to obtain the offline sub-package resources;

[0033] The uniform resource locator adaptation module is used for, when receiving an access request, adding a sub-packaging identifier to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed;

[0034] The uniform resource locator request module is used to load the corresponding offline sub-package resource according to the scope of the uniform resource locator to be accessed when the web page view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version.

[0035] On the other hand, the present application also provides a terminal, including:

[0036] Memory for storing computer programs;

[0037] A processor is used to implement the web resource access method of any embodiment of the present application when executing the computer program.

[0038] On the other hand, the present application further provides a storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the web page resource access method of any embodiment of the present application is implemented.

[0039] It can be seen that in the embodiment of the present application, by downloading the sub-package resources corresponding to the updateable web page resources, the offline sub-package resources are obtained, and the resources that the web access depends on are cached offline. When the access request is received later, the sub-package identifier is added to the corresponding Uniform Resource Locator (URL) to construct a to-be-accessed Uniform Resource Locator that can be hijacked by the web view container (i.e., WebView container); the local offline sub-package resources corresponding to the to-be-accessed Uniform Resource Locator are loaded offline using the WebView container to achieve offline access to web resources. That is, this method can achieve access to web resources in an offline state. Therefore, this method avoids the stuck or stuck phenomenon that occurs when the Hybrid App accesses web resources when the network speed is limited in the related art, or the situation that the web resources cannot be accessed in an offline state, improves the access efficiency of the Hybrid App to web resources, and thus enhances the local experience of the Hybrid App. Furthermore, since this method downloads the updateable web page resources in the form of sub-packaging, that is, the entire updateable web page resource is divided into multiple sub-packaging resources for download, the download success rate and response speed of the updateable web page resource are improved by reducing the size of each sub-packaging resource.

[0040] Correspondingly, the embodiments of the present application also provide a web resource access device, a terminal and a storage medium corresponding to the above-mentioned web resource access method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0042] Figure 1 A schematic diagram of a hardware composition framework applicable to a webpage resource access method according to an embodiment of the present application is shown;

[0043] Figure 2 A schematic diagram showing a flow chart of a webpage resource access method according to an embodiment of the present application;

[0044] Figure 3 A schematic diagram of a process of loading corresponding offline sub-package resources according to a uniform resource locator to be accessed according to an embodiment of the present application is shown;

[0045] Figure 4 A schematic diagram of a process of forming offline sub-packaging resources in an embodiment of the present application is shown;

[0046] Figure 5 A schematic diagram corresponding to an application scenario embodiment of the present application is shown;

[0047] Figure 6 A block diagram showing the composition structure of an embodiment of a webpage resource access device according to an embodiment of the present application is shown;

[0048] Figure 7 A schematic diagram of the hardware structure of a terminal according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] Existing client App (Application) development generally has the following three forms. The first is a Native App (local application) formed by pure Native development (pure local development), the second is an App developed by traditional web technology development or an open source web development framework (such as the React framework (a JavaScript framework)), and the third is a Hybrid App obtained in a mixed development mode of Native development and web development. Since the second type still needs to be implemented on the client through a shell when forming an App after using web development, its final presentation form is similar to a Hybrid App, and both have the problem of freeze or freeze when accessing web resources when the network speed is limited, or the situation where access to web resources cannot be achieved in offline conditions. Therefore, in the embodiment of the present application, the second and third types of Apps are referred to as Hybrid Apps (hybrid mode applications).

[0050] Among them, Native App is located above the platform layer, and its downward access and compatibility capabilities are relatively good. It can support online or offline, message push or local resource access, etc. However, due to device fragmentation, Native App has high development costs, it is troublesome to maintain multiple versions of updates and upgrades, and there are problems such as long iteration cycles and high iteration costs, and the user's installation threshold is also relatively high. The Hybrid App pointed out in the embodiment of the present application has better adaptability to device fragmentation than Native App. For example, a built-in browser is built in the Native App, that is, the appropriate function page can be presented in the form of a web page. However, due to the fact that it is laborious to jump to pages, and when the network speed is limited, the freeze or freeze phenomenon when accessing web resources, or the situation where web resources cannot be accessed in an offline state, the interaction effect with the user is affected, and the sense of instability is stronger. That is, the Hybrid App pointed out in the embodiment of the present application has problems such as access delay, poor experience, and limited Native capabilities. In order to solve the above problems, the embodiments of the present application can realize access to web resources in an offline state, thereby avoiding the lag or freezing of access to web resources caused by limited network speed, improving the efficiency of Hybrid App in accessing web resources, and enhancing the Native experience (i.e., local experience) of Hybrid App.

[0051] For ease of understanding, the hardware composition framework applicable to the solution corresponding to the webpage resource access method of the present application is first introduced. Figure 1 ,in, Figure 1 It shows a schematic diagram of a hardware composition framework applicable to a webpage resource access method of the present application.

[0052] Depend on Figure 1 It can be known that the hardware composition framework may include: a terminal 10 , a resource server 20 and a management device 30 .

[0053] Among them, the management device 30 can receive the sub-package resources (such as the compressed package of the sub-package resources) of the updateable web page resources uploaded by the user (such as the business party), and upload the received sub-package resources to the resource server 20 to realize the cloud push process of the sub-package resources; after completing the cloud push of the sub-package resources, the update push information can be sent to the terminal 10 according to the predetermined sending strategy, so that the terminal 10 can download the required sub-package resources from the resource server 20 through the network, that is, the management device 30 can realize the function of uploading the sub-package resources corresponding to the updateable web page resources to the resource server 20, and the function of sending and pushing the information of updating the updateable web page resources to the terminal 10. Further, when the embodiment of the present application uploads the sub-package resources through the management device 30, if the version number corresponding to the sub-package resource already exists, the sub-package type of the sub-package resource is set to an incremental package and published to the CDN server (i.e., a content distribution network server, a resource server); if the version number corresponding to the sub-package resource does not exist, it means that it is a new whole package, therefore, the sub-package type of the sub-package resource is set to a whole package, and it is directly published to the CDN server. After releasing the CDN server, update the entire package to the web server synchronously.

[0054] Of course, the embodiments of the present application do not limit the sending strategy, and users can set it according to the actual usage scenario. For example, the sending strategy can be that the management device directly sends APNs push to the terminal after completing the cloud push of the sub-packaged resources; wherein APNs push is a method for issuing product push certificates; or it can be sending push information through CDN (Content Delivery Network). The embodiments of the present application also do not limit the specific hardware structure of the management device 30. For example, the management device 30 can be a server, or a CGI device (such as a security gateway), etc.

[0055] Among them, the resource server 20 can be used to store sub-package resources corresponding to the updateable web page resources so that the terminal can download the corresponding sub-package resources. The embodiment of the present application does not limit the specific hardware structure of the resource server 20. For example, the resource server 20 can be a server. The embodiment of the present application does not limit the number and type of the resource server 20. For example, the resource server 20 can include two types of servers, such as CDN servers and web servers. Of course, the number of each type of server can be multiple.

[0056] Among them, the terminal 10 can obtain the update push information issued by the management device 30 on the user interaction interface, and then determine whether it is necessary to download the sub-package resources corresponding to the updateable web resource according to the update push information. When downloading is required, the corresponding sub-package resources can be downloaded from the resource server 20 through the network. After the download process is completed, the resources on which the offline cache web access depends are realized. When receiving an access request, the terminal 10 can use the WebView container (i.e., the web view container) to access the URL (i.e., the uniform resource locator) corresponding to the access request, and finally realize the offline loading of the offline sub-package resources corresponding to the uniform resource locator to be accessed (which can be called the URL to be accessed). It can be understood that the embodiment of the present application does not limit the specific hardware structure of the terminal 10. For example, the terminal 10 can be a mobile phone, a tablet computer, a desktop computer, etc.

[0057] In another possible situation, in order to further ensure the data security of the sub-package resources corresponding to the updateable webpage resources, the embodiment of the present application can download the sub-package resources corresponding to the updateable webpage resources and other data that need to be downloaded from the external device through a secure channel (such as using a security gateway).

[0058] It should be noted that when data is exchanged between devices in the embodiments of the present application, the network used can be determined according to actual needs. It can be a wireless communication network, such as a mobile communication network or a WIFI network, or a wired communication network; it can be a wide area network, and a local area network can also be used when circumstances permit.

[0059] Combining the above commonalities, see Figure 2 , which shows a flow chart of an embodiment of a webpage resource access method of the present application. The method of this embodiment may include:

[0060] S101: When a resource update signal is detected, download sub-package resources corresponding to updateable web page resources to obtain offline sub-package resources.

[0061] It should be noted that the embodiment of the present application does not limit the timing of generating the resource update signal, that is, the embodiment of the present application does not limit the method of detecting the resource update signal. For example, when the terminal detects the existence of an updateable web resource, it may directly generate a resource update signal, that is, detect the resource update signal; of course, the embodiment of the present application does not limit the method of the terminal detecting the existence of an updateable web resource, for example, when the terminal receives the update push information sent by the management device, it is considered that the existence of an updateable web resource is detected; or when the terminal receives the update push information sent by the management device and determines that the updateable web resource corresponding to the update push information is the latest web resource, it is considered that the existence of an updateable web resource is detected. It is also possible that when the terminal detects the existence of an updateable web resource and receives an instruction from the user to allow the download operation, it directly generates a downloadable update web resource signal, that is, a download of the updateable web resource signal is detected; of course, the embodiment of the present application does not limit the method of the user inputting the instruction to allow the download operation. For example, when the terminal receives update push information, the update push information can be output in the terminal (such as voice output, or screen information output). When the user returns an instruction to allow the download operation (such as the user clicks the allow download button, or the user voice inputs the allow download information, or the user clicks the desktop icon to start or clicks the prompt of the update push information to pull up), it is considered that it is detected that the user has entered an instruction to allow the download operation.

[0062] Furthermore, in order to improve the reliability of local offline sub-package resources, when downloading updateable web resources, the embodiments of the present application can improve the reliability of local offline sub-package resources through grayscale rules; for example, a grayscale download test is conducted for a specific group of people, and when the grayscale download test results are reliable, the updateable web resources are released across the board, thereby improving the reliability of the obtained sub-package resources. Of course, the embodiments of the present application do not limit the specific content of the grayscale rules, and the user can determine the population and proportion to be controlled based on actual conditions. Reliability can also be improved by ensuring that the updateable web resources downloaded by the terminal are the latest versions of the resources. That is, before detecting a resource update signal, the embodiments of the present application can also include: downloading update information corresponding to the updateable web resource; judging whether the updateable web resource is the latest version of the web resource based on the update information; and if so, generating a resource update signal.

[0063] It is understandable that the embodiments of the present application do not limit the timing of the update information corresponding to the updateable web resources. For example, when the terminal detects the existence of updateable web resources, it can directly download the corresponding update information from the management device. For example, the H5 container in the terminal checks for updates, and after receiving the APNs push of the management device to release the update, the client App is started to download the update information, or, after receiving the APNs push of the management device to release the update, click to pull up the App, call the H5 container in the terminal to check for updates, and download the update information. Among them, the H5 container is a functional module for providing Native access capability API (application call interface), JS (a language for web development and design), and Native bridging API. Of course, the implementation method of the H5 container is not limited in the embodiments of the present application, and it can meet the needs of web development. Among them, APNs push is a method for issuing product push certificates. Of course, the embodiments of the present application do not limit the implementation form of APNs push.

[0064] The embodiments of the present application do not limit the content of the update information, as long as it is possible to determine whether the updateable web resource is the latest version of the web resource through the update information. For example, the update information may only include the version number of the current updateable web resource. Of course, the update information may include the sub-package ID, the version number of the current updateable web resource, and it may also include the sub-package type (referring to whether the sub-package resource is a full package or an incremental package), the size of the sub-package resource, the full package download URL (Uniform Resource Locator) and HASH value (i.e., hash value), the incremental package download URL and HASH value, the fallback base URL, etc. Among them, the subpackage ID is used to represent the subpackage identifier; the version number is used to record the version number corresponding to the subpackage resource; the size of the subpackage resource is used to record the value of the storage space occupied by the subpackage resource; the whole package download URL is used to record the download address of the subpackage resource corresponding to the whole package web page resource; the whole package download HASH value is used to verify the whole package web page resource; the incremental package download URL is used to record the download address of the subpackage resource corresponding to the incremental package web page resource; the incremental package download HASH value is used to verify the incremental package web page resource; the fallback base URL is used to record the basic entry for adaptation, and there can be multiple resources at the entry.

[0065] When the terminal has downloaded the update information, the update information is used to determine whether the updateable web resource pushed by the management device is the latest version of the web resource. The embodiment of the present application does not limit the judgment process. For example, the version number of the updateable web resource corresponding to the update information can be compared with the version number corresponding to the web resource currently stored in the terminal to determine whether the version number of the updateable web resource corresponding to the update information is higher than the version number corresponding to the web resource currently stored in the terminal. If so, the updateable web resource corresponding to the update information is the latest version of the web resource, and a resource update signal is generated. If not, the updateable web resource corresponding to the update information is not the latest version of the web resource, and a resource update signal is not generated at this time. It can also be that the terminal obtains the latest version number of the updateable web resource from the network, and compares the latest version number with the version number of the updateable web resource corresponding to the update information, and determines whether the version number of the updateable web resource corresponding to the update information is the latest version number. If so, the updateable web resource corresponding to the update information is the latest version of the web resource, and a resource update signal is generated. If not, the updateable web resource corresponding to the update information is not the latest version of the web resource, and a resource update signal is not generated at this time.

[0066] It should be noted that the embodiment of the present application does not limit the method of downloading the sub-package resources corresponding to the updateable web page resources. It can be that as long as the resource update signal is detected, the operation of downloading the sub-package resources corresponding to the updateable web page resources is immediately executed. The operation of downloading the sub-package resources corresponding to the updateable web page resources can also be executed according to the traffic strategy. Among them, the traffic strategy can be to control the online web page resource pulling according to the network conditions and access timing, and realize multi-level web page resource request response according to the request domain.

[0067] Further, in order to improve the adaptability of web resource downloading, the embodiment of the present application performs the operation of downloading the sub-package resources corresponding to the updateable web resource according to the traffic strategy. The download process can be: judging whether the current working network meets the download conditions according to the traffic strategy; if the current working network meets the download conditions corresponding to the traffic strategy, then downloading the sub-package resources corresponding to the updateable web resource. Of course, the embodiment of the present application does not limit the specific content of the traffic strategy, and it can be set according to the network type and the size of the sub-package resources. For example, if the sub-package size corresponding to the sub-package resource does not exceed 3M, it can be directly downloaded under all network conditions (such as mobile networks, wifi networks and wireless networks); if the sub-package size corresponding to the sub-package resource exceeds 3M, it is only downloaded under non-mobile network conditions (such as downloading under wifi network and wireless network conditions). The user can also modify the traffic strategy according to the actual situation during subsequent use.

[0068] It is understandable that in the embodiment of the present application, the terminal downloads the sub-package resources corresponding to the updateable web page resources from the resource server storing the updateable web page resources through the network. However, the embodiment of the present application does not limit the way to obtain the sub-package resources corresponding to the updateable web page resources from the resource server. For example, the resource server can directly obtain the sub-package resources corresponding to the updateable web page resources from the management device, that is, the management device uploads the sub-package resources corresponding to the updateable web page resources to the resource server. For example, when the management device generates the sub-package resources, if the sub-package resources of this version already exist, the sub-package type of the generated sub-package resources is an incremental package, and it is published to the CDN server; if the sub-package resources of this version do not exist, it proves that it is a new whole package, then the sub-package type of the generated sub-package resources is a whole package, and it is directly published to the CDN server. After the sub-package resources are published to the CDN, the whole package resources are synchronously updated to the web server, so that the terminal can access the updateable web page resources online through the web server. Of course, the specific implementation form of the management device uploading the sub-package resources is not limited in the embodiment of the present application.

[0069] It should be noted that the embodiment of the present application does not limit the way in which the management device obtains the sub-package resources corresponding to the updateable web resource. For example, after the development of the Hybrid App is completed, the updateable web resource is divided into corresponding sub-package resources according to the sub-package strategy, and each sub-package resource can be a resource compression package containing corresponding directory information. Among them, the directory information corresponding to each sub-package resource can be: sub-package ID / host. If there is a port, the sub-package directory corresponding to each sub-package resource can be: sub-package ID / host-port, such as pkid - test1 / test.offline.com. The subpackage resources corresponding to the directory information are placed in the directory and compressed to form subpackage resources. Among them, the subpackage strategy can be used to subpackage the whole package of web page resources, such as whole package subpackage or incremental package subpackage. The process can be: when the updateable web page resource has an old version of the web page resource package, the subpackage resources corresponding to the updateable web page resource can be obtained by incremental calculation, and the subpackage resources are the subpackage resources corresponding to the incremental package (that is, the newly added resource part that is different from the existing old version); when the updateable web page resource does not have an old version of the resource package, the updateable web page resource is directly divided into the subpackage resources corresponding to the whole package. The subpackage strategy is used to improve the success rate and response speed of pulling web page resources.

[0070] Of course, the embodiment of the present application does not limit the content of the sub-packaging strategy, and it can be set and modified according to the actual situation of the developed HybridApp. For example, the sub-packaging strategy can be: the necessary resources with priority access are divided into the same sub-package, and the public and stable resources are divided into the same sub-package; on this basis, the size of a single sub-package resource can be limited, thereby further improving the download success rate of updateable web resources. It can be seen that when downloading updateable web resources, this method can download updateable web resources in the form of sub-packaging, that is, the entire updateable web resource is divided into multiple sub-package resources for download, and the download success rate and response speed of the updateable web resources are improved by reducing the size of each sub-package resource.

[0071] When the sub-package resources corresponding to the updateable web resources are downloaded, the embodiments of the present application can form local offline sub-package resources in the terminal, so as to facilitate the subsequent response to the user's request to access the offline web resources, so as to achieve opening in seconds. For example, when the sub-package resources corresponding to the updateable web resources are downloaded as resource compression packages (such as zip packages), the sub-package resources can be decompressed and replaced to form offline sub-package resources. After obtaining the offline sub-package resources, the embodiments of the present application can store the offline sub-package resources locally for subsequent direct access or offline access. Of course, the embodiments of the present application do not limit the specific decompression and replacement implementation methods.

[0072] Furthermore, in order to improve the security and reliability of data during the download of sub-package resources corresponding to updateable web resources in the embodiments of the present application, the problems of relatively low security and easy data leakage or hijacking in the related technologies including Apps obtained through web development are overcome. In the embodiments of the present application, sub-package resources corresponding to updateable web resources can be downloaded through a secure channel, as well as update information corresponding to updateable web resources through a secure channel, that is, data that needs to be obtained from external devices can be downloaded through a secure channel. For example, a security gateway can be used to download update information and sub-package resources corresponding to updateable web resources. In order to further improve data security, the data can also be encrypted and then downloaded through a secure channel, that is, encrypted data that needs to be obtained from external devices can be downloaded through a secure channel. For example, encrypted update information and encrypted sub-package resources corresponding to updateable web resources can be downloaded through a secure channel.

[0073] S102: When an access request is received, a sub-packaging identifier is added to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed.

[0074] The embodiment of the present application does not limit the content of the access request. For example, the user's operation of opening the HybridApp can be used as the access request; or after entering the Hybrid App, the access request can be initiated when the waiting time exceeds the preset time; or the user clicking on a function in the Hybrid App can be used as the access request, etc. It is understandable that since the embodiment of the present application does not limit the content of the access request, the embodiment of the present application will not limit the URL corresponding to the access request. The content and quantity corresponding to the URL are related to the access request.

[0075] After receiving an access request, the embodiment of the present application needs to adapt all URLs corresponding to the access request, because the embodiment of the present application accesses the uniform resource locator to be accessed (which can be called the URL to be accessed) in the web view container (i.e., WebView container) in the terminal, that is, accesses web resources in the WebView container in the terminal. Among them, the WebView container is used to display web pages, which may include a UIViewController (view controller) used by WebView to display web pages. Therefore, during the adaptation process, a sub-package identifier is added to the URL that needs to access offline sub-package resources. By adding a sub-package identifier to the URL corresponding to the access request, the embodiment of the present application can construct the URL corresponding to the access request into a URL that can be hijacked by the WebView container, and can achieve offline hijacking access to the URL to be accessed, that is, enable the WebView container to hijack the URL to be accessed.

[0076] Of course, the embodiment of the present application does not limit the method of adding the sub-packaging identifier. For example, a query parameter (i.e., a query parameter) is added to the end of the URL corresponding to the access request, wherein the query parameter is a query parameter, such as _PKID= <pkid1> + <pkid2>, where _PKID represents the use of offline requests, <pkid1>as well as <pkid2>They represent sub-package identifiers, which are the local directory information of the corresponding sub-package resources. It can be seen from the query parameters in the above examples that the embodiment of the present application does not limit the number of sub-package identifiers added after the URL corresponding to the access request. It can be just one sub-package identifier or multiple sub-package identifiers. Of course, it can also be all the sub-package identifiers that can exist in the URL corresponding to the access request. Users can set it according to actual needs.

[0077] It should be noted that, since a WebView container can generally only implement one URL request to be accessed at a time, that is, a WebView container can only be initialized with one URL to be accessed. Therefore, when the number of URLs to be accessed obtained in the embodiment of the present application is greater than 1, multiple WebView containers can be initialized at the same time, and one WebView container can be initialized for each URL to be accessed. Of course, only one WebView container can be initialized at a time, and the initialized WebView container only performs corresponding operations on one URL to be accessed. The loop is executed multiple times until all URLs to be accessed are accessed.

[0078] S103: When the web page view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version, the corresponding offline sub-package resource is loaded according to the scope of the uniform resource locator to be accessed.

[0079] In the embodiment of the present application, in a web view container, i.e., a WebView container, the scope adaptation of the hijacked URL to be accessed is performed to determine the offline sub-packaged resource object that needs to be loaded. Normally, after initiating a WebView request, the WebView container performs a process of scope adaptation of the hijacked URL to be accessed to determine the offline sub-packaged resource object that needs to be loaded. Of course, in the embodiment of the present application, there is no limitation on the timing of initiating a WebView request by the WebView container, as long as it is performed before the scope adaptation of the hijacked URL to be accessed is performed to determine the offline sub-packaged resource object that needs to be loaded. For example, the WebView request can be initiated after the WebView container is initialized.

[0080] Of course, the embodiments of the present application do not limit the implementation method of loading the corresponding offline sub-package resources according to the scope of the URL to be accessed. The process can be: from the directory information corresponding to all offline sub-package resources, determine the directory information corresponding to the scope of the uniform resource locator to be accessed to obtain the target directory information; load the offline sub-package resources corresponding to the target directory information. Among them, the scope of the URL to be accessed includes host (host) or host-port (host + port), and sub-package ID. That is, by comparing the host (host) or host-port (host + port) of the hijacked URL to be accessed, and the sub-package ID with the sub-package ID / host (or sub-package host-port) in the directory information corresponding to all offline sub-package resources, it is determined whether there is directory information consistent with the scope of the URL to be accessed; if there is directory information corresponding to the scope of the URL to be accessed, it is considered that the target directory information is obtained; and then the offline sub-package resources corresponding to the target directory information can be loaded.

[0081] Take an example to illustrate the scope matching process: if the uniform resource locator to be accessed is specifically: http: / / test.offline.com / index.html?_PKID=pkid_test1, and the directory information of the offline sub-package resources stored locally is specifically: pkid_test1 / test.offline.com. Through the adaptation of the scope of the URL to be accessed, it can be seen that the sub-package ID contained in the scope of the URL to be accessed is pkid_test1, and the host is test.offline.com. After comparing with the directory information corresponding to all offline sub-package resources, the directory information of the sub-package resources in the offline sub-package resources can be hit as the sub-package resources in pkid_test1 / test.offline.com. Loading the corresponding offline sub-package resources in pkid_test1 / test.offline.com does not require initiating a network request. Among them, loading is the process of transferring useful programs on the hard disk to the memory. The embodiment of the present application realizes offline loading of web resource access in seconds by loading local sub-package resources offline, which greatly improves the access efficiency to web resources.

[0082] It should be noted that if the hijacked URL to be accessed is scope-adapted and no resource is hit in the offline sub-package resources, it can be considered that the resources required by the URL to be accessed are not stored locally. The embodiment of the present application does not limit the content of the operation that needs to be performed after no resource is hit in the offline sub-package resources. For example, it can be determined whether there is a fallback URL (i.e., an online backup uniform resource locator). If there is a fallback URL, the fallback URL is directly requested online; if there is no fallback URL, the URL to be accessed is requested online.

[0083] In order to improve the reliability and accuracy of offline loading of the local offline sub-package resources corresponding to the URL to be accessed, and then improve the reliability of offline access to web resources and improve user experience. Before the offline loading of the local offline sub-package resources corresponding to the URL to be accessed, the embodiment of the present application can determine in advance whether the version of the local offline sub-package resources corresponding to the URL to be accessed is the latest version; if it is the latest version, the local offline sub-package resources corresponding to the URL to be accessed can be directly loaded offline; if it is not the latest version, it is considered that the local offline sub-package resources are not the latest data. In order to improve the reliability of offline access to web resources, the latest web resources can be obtained and returned to the user in the form of online access. Of course, the embodiment of the present application does not limit the specific content of the online request for the URL to be accessed, which can be a direct online request for the URL to be accessed. It can also be to determine the network status of the current terminal, and only when the network status is good, directly request the URL to be accessed online. It can also be to determine whether there is a fallback URL. If there is a fallback URL, directly request the fallback URL online; if there is no fallback URL, directly request the URL to be accessed online. Among them, the fallback URL refers to the online backup network address taken when the corresponding version of the offline sub-package resource does not exist locally, that is, the online backup uniform resource locator. It can also be determined whether the current terminal is in an offline state. When the terminal has a network connection, directly request the URL to be accessed online; when the terminal does not have a network connection, first load the local offline sub-package resources offline.

[0084] In the mechanism of WebView offline caching, the embodiment of the present application caches the resources that web access depends on offline based on the traffic strategy and the sub-packaging strategy, and realizes offline access to web resources by offline loading the local sub-packaging resources corresponding to the URL to be accessed, thereby improving the access efficiency of the Hybrid App to web resources and enhancing the Native experience of the Hybrid App; it can be understood that the embodiment of the present application improves the web access efficiency through offline loading technology, that is, based on the traffic strategy and the sub-packaging strategy, pulls the online web page resources to the local at an appropriate time, hijacks the WebView request, and loads the locally available offline sub-packaging resources according to the scope to improve the web access efficiency. Furthermore, the embodiment of the present application only uses sub-packaging and offline loading technology, without changing the development tools and development mode of the Hybrid App, to increase the survival ability of the Hybrid App pointed out in this application under network speed restrictions and offline conditions, and improves the loading speed of web resources, and even achieves the effect of opening in seconds, thereby improving the Native experience of the Hybrid App. Therefore, the embodiment of the present application can expand the development mode of the terminal App, support the technical selection of any web development, and reduce the learning cost of web development. Furthermore, the development of the Hybrid App provided in the embodiments of the present application can have the characteristics of low cost and high efficiency, and is very suitable for the development of Apps with rapid business iteration.

[0085] In the embodiment of the present application, by downloading the sub-package resources corresponding to the updateable web page resources, the offline sub-package resources are obtained, and the resources dependent on the web access are cached offline. When the access request is received later, the URL to be accessed that can be hijacked by the WebView container is constructed by adding a sub-package identifier to the corresponding URL; the local offline sub-package resources corresponding to the URL to be accessed are loaded offline by using the WebView container to achieve offline access to the web resources. It can be seen that the method can access the web resources offline. Therefore, the method avoids the stuck or stuck phenomenon when the Hybrid App accesses the web resources when the network speed is limited in the related art, or the situation that the web resources cannot be accessed offline, improves the access efficiency of the Hybrid App to the web resources, and thus enhances the Native experience of the Hybrid App; further, because the method can download the updateable web resources in the form of sub-packages when downloading the updateable web resources, that is, the entire updateable web resources are divided into multiple sub-package resources for download, and the download success rate and response speed of the updateable web resources are improved by reducing the size of each sub-package resource.

[0086] In one possible case, the embodiment of the present application provides a process for loading the corresponding offline sub-package resource according to the uniform resource locator to be accessed; please refer to Figure 3 The specific execution process is as follows:

[0087] S301. Check whether the offline sub-package resource corresponding to the URL to be accessed in the WebView container is the latest version; if so, execute step S302; if not, execute step S305.

[0088] In the embodiment of the present application, the hijacking of the URL to be accessed can be achieved by hooking the URL to be accessed.

[0089] S302: Mark all sub-packages included in the URL to be accessed as offline access.

[0090] In the embodiment of the present application, by marking all sub-package identifiers contained in the URL to be accessed as offline access, it is possible to confirm the offline sub-package resources that the URL to be accessed may need to be downloaded offline. The embodiment of the present application does not limit the method of marking all sub-package identifiers contained in the URL to be accessed as offline access. For example, all sub-package identifiers contained in the URL to be accessed can be marked as offline access by cache mapping.

[0091] It should be noted that the embodiment of the present application does not limit the execution timing of marking all sub-packets corresponding to the URL to be accessed as offline access. Figure 3 As shown in step S301, after checking that the offline sub-package resources corresponding to the URL to be accessed in the WebView container are the latest versions, the step of marking all sub-packages corresponding to the URL to be accessed as offline access is directly executed. It can also be the step of marking all sub-packages corresponding to the URL to be accessed as offline access before the scope adaptation of the URL to be accessed is performed. It can also be the step of marking all sub-packages corresponding to the URL to be accessed as offline access after obtaining the URL to be accessed.

[0092] S303. From the directory information corresponding to all offline sub-package resources, determine whether the target directory information corresponding to the scope of the URL to be accessed is hit; if it is hit, execute step S304; if not, execute step S305.

[0093] S304: Load offline sub-package resources corresponding to the target directory information.

[0094] In order to increase data security in the embodiment of the present application, after loading the offline sub-package resources corresponding to the target directory information, if certain conditions are met, the web view container, that is, the WebView container, can be destroyed and the sub-package identification (such as the sub-package ID) of the corresponding sub-package resources loaded offline can be canceled. Of course, the embodiment of the present application does not limit the condition. For example, when the user turns off the display page, the operation of destroying the WebView container and canceling the sub-package identification of the corresponding sub-package resources loaded offline can be performed. It can also be pushed to the background for a preset time, and the operation of destroying the WebView container and canceling the sub-package identification of the corresponding sub-package resources loaded offline can be performed. Obviously, the embodiment of the present application does not limit the value of the preset time. It can also be when the App operation is received, the operation of destroying the WebView container and canceling the sub-package identification of the corresponding sub-package resources loaded offline can be performed.

[0095] S305. Determine whether there is a fallback URL in the URL to be accessed; if so, execute step S306; if not, execute step S307.

[0096] It can be understood that the embodiment of the present application can generate an online backup uniform resource locator, i.e., a fallback URL, at the same time as the offline sub-package resource is formed. The embodiment of the present application does not limit the generation method of the fallback URL. For example, when the version number of the offline sub-package resource is less than the version number in the update information, and at least one sub-package ID in the PKID (sub-package identifier) ​​has a fallback base URL, the fallback URL is set to the fallback base URL / path of the URL to be accessed (i.e., fallback base URL+ / +path of the current URL). For example: URL to be accessed: http: / / test.offline.com / index.html? _PKID=pkid_test1+pkid_test2; the fallbackbaseURL of the update information is: http: / / cdn.offline.com / version / 007 / pkid_test1; then the fallback URL is: http: / / cdn.offline.com / version / 007 / pkid_test1 / test.offline.com / index.html.

[0097] It should be noted that the embodiments of the present application do not limit the method of checking whether there is a fallback URL in the URL to be accessed in the WebView container. For example, the WebView container is checked for a CDN online fallback URL. If so, the fallback URL is accessed. When there are fallback URLs in multiple sub-packages, the fallback URL obtained first shall prevail.

[0098] S306: Request the fallback URL online.

[0099] In the embodiment of the present application, the corresponding resources are accessed through the fallback URL. In the embodiment of the present application, in order to increase data security, after downloading the resources corresponding to the fallback URL, the WebView container can be destroyed if certain conditions are met. Of course, the embodiment of the present application does not limit the condition. For example, when the user turns off the display page, the operation of destroying the WebView container can be executed. It can also be pushed to the background for a preset time, and the operation of destroying the WebView container can be executed. Of course, the embodiment of the present application does not limit the value of the preset time. It can also be when the App is forced to quit, the operation of destroying the WebView container can be executed.

[0100] S307: Request the URL to be accessed online.

[0101] In the embodiment of the present application, when there is no offline sub-package resource that needs to be accessed locally in the terminal and there is no fallbackURL, only online resources can be accessed. In the embodiment of the present application, in order to increase data security, after downloading the corresponding resource, the download thread can be destroyed if certain conditions are met. Of course, the embodiment of the present application does not limit the condition. For example, the condition can be that the push to the background reaches a preset time. Of course, the embodiment of the present application does not limit the value of the preset time. It can also be receiving a forced exit of the App operation.

[0102] In the embodiment of the present application, by combining offline loading of corresponding web resources and online downloading of related web resources, the access efficiency of web resources can be further improved. Whether there is a network or not, access to web resources can be quickly achieved, thereby increasing the access efficiency of Hybrid App to web resources, thereby enhancing the Native experience of Hybrid App.

[0103] In another possible situation, the embodiment of the present application provides a process for forming offline sub-packaging resources; please refer to Figure 4 The specific execution process is as follows:

[0104] S401, determine whether the sub-packaging type of the sub-packaging resource is an incremental package; if it is not an incremental package, execute step S402; if it is an incremental package, execute step S403;

[0105] S402, decompress and replace the sub-package resources to form offline sub-package resources;

[0106] S403, merge the sub-package resources into the locally solidified sub-package resources, and determine whether the merging is successful; if the merging is successful, execute step S404; if the merging fails, execute step S405;

[0107] S404, decompress and replace the merged sub-package resources to form offline sub-package resources;

[0108] S405: Change the sub-packaging type to the whole package, and download the whole package resource corresponding to the sub-package resource. After the download is completed, continue to execute step S401.

[0109] In order to avoid repeated downloading of already downloaded resources, the embodiment of the present application further divides the sub-package resources into incremental packages and whole packages. Therefore, in order to improve the reliability of offline sub-package resources obtained locally, when the sub-package resources are downloaded to form offline sub-package resources, different operations can be performed according to the different sub-package types of the sub-package resources. It should be noted that the embodiment of the present application does not limit the method for obtaining the sub-package type of the sub-package resources. For example, the sub-package type of the downloaded sub-package resources can be obtained according to the update information.

[0110] When the sub-package type of the sub-package resource is a whole package, it proves that the Hybrid App corresponding to the sub-package resource is a new App. Therefore, there is no data about the App in the terminal, and the downloaded sub-package resource can be directly decompressed and replaced to form an offline sub-package resource. When the sub-package type of the sub-package resource is an incremental package, it proves that the Hybrid App corresponding to the sub-package resource already exists in the terminal. Therefore, it is necessary to merge the sub-package resources with changes into the locally solidified sub-package resources, and after the merger is successful, the merged sub-package resources are decompressed and replaced to form offline sub-package resources. If the merger fails, the sub-package type can be modified to a whole package, and the whole package resource corresponding to the sub-package resource can be downloaded. That is, the complete web resource corresponding to the App is downloaded again to prevent the user from being unable to use the App or the corresponding related functions of the App after the merger fails. Of course, in the embodiment of the present application, when downloading the complete web resource, the entire complete web resource package can be downloaded directly at one time, or the sub-package resource corresponding to the complete web resource can be downloaded.

[0111] Of course, the embodiment of the present application does not limit the specific content of step S405. The user can set it according to the actual situation. For example, step S405 can also be set to repeat the merge operation for a predetermined number of times. If all fail, the sub-package type is changed to a whole package, and the whole package resources corresponding to the sub-package resources are downloaded; the embodiment of the present application does not limit the value of the predetermined number of times, such as 3 times. It can also be that if the merge fails, a prompt message is output, and the sub-package type is changed to a whole package, and the whole package resources corresponding to the sub-package resources are downloaded. The embodiment of the present application does not limit the specific decompression replacement implementation method.

[0112] Further, in order to ensure the reliability of the whole package resource corresponding to the downloaded sub-package resource, after downloading the whole package resource, step S401 can be continued to be executed to obtain the offline sub-package resource or offline resource after decompression and replacement. Further, in order to save storage space in the terminal and improve the utilization rate of storage space, the embodiment of the present application can also delete expired offline sub-package resources.

[0113] It can be seen that in the embodiment of the present application, in order to avoid repeated downloading of the downloaded resources, the sub-package resources are further divided into incremental packages and whole packages. Furthermore, in order to improve the reliability of the offline sub-package resources obtained locally, the relevant decompression and replacement processes are set for the incremental packages and the whole packages respectively, so as to improve the reliability of the decompression and replacement of the downloaded sub-package resources, thereby improving the reliability of the local offline sub-package resources in the terminal.

[0114] For easier understanding, please refer to Figure 5 , combined with an application scenario of this solution, the following application scenario of terminal, CDN server, web server and management device, and web resource access in financial App is used to explain the process of web resource access. That is, the embodiment of this application provides a low-threshold web development model.

[0115] The user uploads the sub-package resources corresponding to the updateable web page resources to the management device (which can be a management cloud platform) through a secure channel, wherein the sub-package resources are formed by dividing the updateable web page resources through a sub-package strategy. The management device uploads the sub-package resources to the CDN server and the web server. The process can be: when the management device uploads the sub-package resources, if the version number corresponding to the sub-package resource already exists, the sub-package type of the sub-package resource is set to an incremental package and published to the CDN server; if the version number corresponding to the sub-package resource does not exist, it means that it is a new whole package, therefore, the sub-package type of the sub-package resource is set to a whole package, and then it is directly published to the CDN server. After publishing the CDN server, the whole package is synchronously updated to the web server so that the terminal can access online resources through the web server, such as online access to updateable web resources through the web server. After completing the upload of the sub-package resources, the management device sends update push information to the terminal according to the established strategy.

[0116] The terminal checks the push information through the H5 container. When it is determined that the sub-package resource corresponding to the updateable webpage resource needs to be downloaded, the terminal downloads the sub-package resource corresponding to the updateable webpage resource from the CDN server or the web server through a secure channel. And the sub-package resource is decompressed and replaced accordingly to form an offline sub-package resource. When the terminal receives the access request, it adapts the URL corresponding to the access request, adds a sub-package identifier to the URL that needs to be accessed offline (that is, adds the sub-package ID as a query parameter at the end of the corresponding URL) to form a URL to be accessed. A WebView container is initialized for each URL to be accessed, and each URL to be accessed is executed in the WebView container. The access process can be: checking whether the offline sub-package resource corresponding to the URL to be accessed in the WebView container is the latest version; if the offline sub-package resource corresponding to the URL to be accessed in the WebView container is not the latest version, then determining whether there is a fallback URL in the URL to be accessed; if there is a fallback URL, then requesting the fallback URL online. If there is no fallback URL, then requesting the URL to be accessed online. If the offline sub-package resource corresponding to the URL to be accessed in the WebView container is the latest version, then marking all sub-package identifiers corresponding to the URL to be accessed as offline access. From the directory information corresponding to all offline sub-package resources, determine whether the directory information corresponding to the scope of the uniform resource locator to be accessed is hit to obtain the target directory information; if it is hit, load the offline sub-package resources corresponding to the target directory information. If it is not hit, determine whether there is a fallback URL in the URL to be accessed; if there is a fallback URL, request the fallback URL online. If there is no fallback URL, request the URL to be accessed online.

[0117] This application scenario embodiment is applied in the financial App. Therefore, in order to improve data security, the terminal needs to download the corresponding sub-package data and data sent by other external devices through a secure channel. It is also possible to encrypt the sub-package data and data sent by other external devices first, and then download them through a secure channel. This application scenario embodiment provides access to web resources in an offline state, thereby avoiding the lag or freezing phenomenon that occurs when the Hybrid App accesses web resources when the network speed is limited in the prior art, or the situation where the web resources cannot be accessed in an offline state, thereby increasing the access efficiency of the Hybrid App to web resources, thereby enhancing the Native experience of the Hybrid App.

[0118] On the other hand, the present application also provides a web resource access device. Figure 6 , which shows a schematic diagram of the composition structure of an embodiment of a webpage resource access device of the present application. The device of this embodiment can be applied to the terminal in the above embodiment, and the device includes:

[0119] The webpage resource downloading module 101 is used to download the sub-package resources corresponding to the updateable webpage resources when a resource update signal is detected, so as to obtain the offline sub-package resources;

[0120] The uniform resource locator adaptation module 102 is used for adding a sub-packaging identifier to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed when receiving the access request; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed;

[0121] The uniform resource locator request module 103 is used to load the corresponding offline sub-package resource according to the scope of the uniform resource locator to be accessed when the web page view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version.

[0122] Optionally, the uniform resource locator adaptation module 102 may include:

[0123] The sub-package identification adding unit adds a query parameter at the end of the uniform resource locator corresponding to the access request.

[0124] Optionally, the device may further include:

[0125] The online request module is used to determine whether there is an online backup uniform resource locator in the uniform resource locator to be accessed when the offline sub-package resource corresponding to the uniform resource locator to be accessed in the web page view container is not the latest version; if so, the online backup uniform resource locator is requested online; if not, the uniform resource locator to be accessed is requested online.

[0126] Optionally, the device may further include:

[0127] The offline access identification module is used to mark all sub-package identifications contained in the uniform resource locator to be accessed as offline access.

[0128] Optionally, the device may further include:

[0129] An update information downloading unit, used to download update information corresponding to the updateable web page resource;

[0130] The detection unit is used to determine whether the updateable web page resource is the latest version of the web page resource according to the update information; if so, a resource update signal is generated.

[0131] Optionally, the web resource downloading module 101 may include:

[0132] A traffic strategy determination unit, used to determine whether the current working network meets the downloading conditions according to the traffic strategy;

[0133] The resource downloading unit is used to download the sub-package resources corresponding to the updateable web page resources if the downloading conditions are met.

[0134] Optionally, the resource download unit may include:

[0135] The resource download subunit is used to download the sub-package resources corresponding to the updateable web page resources from the resource server; the sub-package resources are resource compression packages containing corresponding directory information.

[0136] Accordingly, the uniform resource locator request module 103 may include:

[0137] A matching unit, used to determine the directory information corresponding to the scope of the uniform resource locator to be accessed from the directory information corresponding to all offline sub-package resources, so as to obtain the target directory information;

[0138] The loading unit is used to load the offline sub-package resources corresponding to the target directory information.

[0139] Optionally, the web resource downloading module 101 may include:

[0140] A sub-packet type determination unit, used to determine whether the sub-packet type of the sub-packet resource is an incremental package;

[0141] The whole package decompression and replacement unit is used to decompress and replace the sub-package resources if the sub-package type of the sub-package resource is not an incremental package, so as to form an offline sub-package resource;

[0142] The incremental package merging unit is used to merge the incremental package into the locally solidified subpackage resource if the subpackage type of the subpackage resource is an incremental package, and determine whether the merging is successful;

[0143] The incremental package decompression and replacement unit is used to decompress and replace the merged sub-package resources to form offline sub-package resources if the merge is successful;

[0144] The download unit is used to change the sub-package type to the whole package if the merge fails, and download the whole package resource corresponding to the sub-package resource.

[0145] On the other hand, the present application also provides a terminal, which may include a processor and a memory. The relationship between the processor and the memory in the terminal can be referred to Figure 7 The processor of the terminal is used to execute the program stored in the memory; the memory of the terminal is used to store the program, which is at least used to implement the webpage resource access method described above.

[0146] Of course, the terminal may also include a communication interface, a display unit, an input device, etc., which are not specifically limited here.

[0147] Depend on Figure 7 It can be known that the hardware composition framework may include: a terminal 10 , wherein the terminal 10 may include: a processor 11 , a memory 12 , a communication interface 13 , an input unit 14 , a display 15 and a communication bus 16 .

[0148] The processor 11, the memory 12, the communication interface 13, the input unit 14, and the display 15 all communicate with each other through the communication bus 16. In the embodiment of the present application, the processor 11 may be a central processing unit (CPU), a specific application integrated circuit, a digital signal processor, a ready-made programmable gate array, or other programmable logic devices. The processor may call the program stored in the memory 12. Specifically, the processor may execute the operations performed by the terminal side in each embodiment of the above web resource access method. The memory 12 is used to store one or more programs, and the program may include a program code, and the program code includes a computer operation instruction. In the embodiment of the present application, the memory at least stores a program for implementing the following functions:

[0149] When a resource update signal is detected, the sub-package resources corresponding to the updateable web page resources are downloaded to obtain offline sub-package resources;

[0150] When receiving an access request, adding a sub-packaging identifier to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed;

[0151] When the web page view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version, the corresponding offline sub-package resource is loaded according to the scope of the uniform resource locator to be accessed.

[0152] In one possible implementation, the memory 12 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, and applications required for at least one function (such as a sound playback function, a display function, etc.); the data storage area may store data generated during the use of the terminal, such as data corresponding to offline subpackaging resources, etc.

[0153] In addition, the memory 12 may also include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.

[0154] The communication interface 13 may be an interface of a communication module, such as an interface of a GSM module.

[0155] The present application may further include a display 14 and an input unit 15 and the like.

[0156] certainly, Figure 7 The structure of the terminal shown does not constitute a limitation on the terminal in the embodiment of the present application. In actual applications, the terminal may include Figure 7 More or fewer components as shown, or combinations of certain components. Figure 7 The terminal 10 in the example may be a mobile terminal (such as a mobile phone, a tablet, etc.).

[0157] In an embodiment of the present application, the processor 11 in the terminal 10 can receive the sub-package resources corresponding to the updateable web page resources from the communication interface 13 or the input unit 14 through the communication bus 16, and call the program stored in the memory 12 to realize offline loading of the offline sub-package resources corresponding to the scope of the uniform resource locator to be accessed.

[0158] On the other hand, the present application further provides a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, it is used to implement the web resource access method described in any of the above embodiments.

[0159] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0160] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0161] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0162] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention. < / pkid1>

Claims

1. A webpage resource access method, characterized in that: include: When a resource update signal is detected, the sub-package resources corresponding to the updateable web page resources are downloaded to obtain offline sub-package resources; When receiving an access request, a sub-packaging identifier is added to the uniform resource locator corresponding to the access request to obtain the uniform resource locator to be accessed; the sub-packaging identifier is used to enable the web page view container to hijack the uniform resource locator to be accessed; When the webpage view container hijacks the uniform resource locator to be accessed and the offline sub-package resource corresponding to the uniform resource locator to be accessed is the latest version, determining the directory information corresponding to the scope of the uniform resource locator to be accessed from the directory information corresponding to the offline sub-package resource to obtain the target directory information; Load the offline sub-package resources corresponding to the target directory information.

2. The webpage resource access method according to claim 1, characterized in that: The adding of a sub-packet identifier in the uniform resource locator corresponding to the access request comprises: Add a query parameter at the end of the uniform resource locator corresponding to the access request.

3. The webpage resource access method according to claim 1, characterized in that: If the offline sub-package resource corresponding to the to-be-accessed uniform resource locator in the webpage view container is not the latest version, it includes: Determining whether there is an online backup uniform resource locator in the uniform resource locator to be accessed; If it exists, then requesting the online backup uniform resource locator online; If it does not exist, then an online request is made for the uniform resource locator to be accessed.

4. The webpage resource access method according to claim 1, characterized in that: Before the resource update signal is detected, the method further includes: Download update information corresponding to updateable web resources; Determining whether the updateable webpage resource is the latest version of the webpage resource according to the update information; If so, a resource update signal is generated.

5. The webpage resource access method according to claim 1, characterized in that: The downloading of sub-package resources corresponding to the updateable webpage resources includes: Determine whether the current working network meets the download conditions based on the traffic strategy; If it matches, then download the subpackage resource corresponding to the updateable webpage resource.

6. The webpage resource access method according to claim 5, characterized in that: The downloading of sub-package resources corresponding to the updateable webpage resources includes: Download sub-package resources corresponding to the updateable web page resources from the resource server; the sub-package resources are resource compression packages containing corresponding directory information.

7. The webpage resource access method according to claim 4, characterized in that: The update information corresponding to the downloadable updateable webpage resource and the sub-package resources corresponding to the downloadable updateable webpage resource include: The update information and the sub-package resources corresponding to the updateable web page resources are downloaded through a security gateway.

8. The webpage resource access method according to claim 1, characterized in that: The obtaining of offline sub-package resources includes: Determine whether the sub-packaging type of the sub-packaging resource is an incremental package; If it is not an incremental package, decompress and replace the sub-package resources to form offline sub-package resources; If it is an incremental package, merge the subpackage resources into the locally solidified subpackage resources, and determine whether the merging is successful; If the merge is successful, the merged subpackage resources are decompressed and replaced to form offline subpackage resources; If the merging fails, the sub-package type is changed to a whole package, and the whole package resource corresponding to the sub-package resource is downloaded.

9. A webpage resource access device, characterized in that: include: The webpage resource download module is used to download the sub-package resources corresponding to the updateable webpage resources when a resource update signal is detected, so as to obtain the offline sub-package resources; A Uniform Resource Locator (URL) adaptation module, which is used to add a subpackage identifier to the URL corresponding to the access request when receiving the access request, so as to obtain the URL to be accessed; the subpackage identifier is used to enable the web view container to hijack the URL to be accessed. A URL request module, which is used to determine the directory information corresponding to the scope of the URL to be accessed from the directory information corresponding to the offline subpackage resource when the web view container hijacks the URL to be accessed and the offline subpackage resource corresponding to the URL to be accessed is the latest version, so as to obtain the target directory information; and load the offline subpackage resource corresponding to the target directory information.

10. The device according to claim 9, characterized in that The URL adaptation module includes: A subpackage identifier adding unit, which adds a query parameter to the end of the URL corresponding to the access request.

11. The device according to claim 9, characterized in that The device further includes: An online request module, which is used to determine whether there is an online backup URL in the URL to be accessed when the offline subpackage resource corresponding to the URL to be accessed in the web view container is not the latest version; if so, online request the online backup URL; if not, online request the URL to be accessed.

12. The device according to claim 9, characterized in that The device further includes: An update information download unit, which is used to download the update information corresponding to the updatable web resource. A detection unit, which is used to determine whether the updatable web resource is the latest version of the web resource according to the update information; if so, generate a resource update signal.

13. The device according to claim 9, characterized in that The web resource download module includes: A traffic policy judgment unit, which is used to judge whether the current working network meets the download conditions according to the traffic policy. A resource download unit, which is used to download the subpackage resource corresponding to the updatable web resource if the download conditions are met.

14. The device according to claim 13, characterized in that The resource download unit includes: A resource download subunit, which is used to download the subpackage resource corresponding to the updatable web resource from the resource server; the subpackage resource is a resource compression package containing the corresponding directory information.

15. The device according to claim 9, characterized in that The web resource download module includes: A subpackage type judgment unit, which is used to judge whether the subpackage type of the subpackage resource is an incremental package. A whole package decompression and replacement unit, which is used to perform decompression and replacement on the subpackage resource to form an offline subpackage resource if the subpackage type of the subpackage resource is not an incremental package. An incremental package incorporation unit, which is used to incorporate the incremental package into the locally solidified subpackage resource and judge whether the incorporation is successful if the subpackage type of the subpackage resource is an incremental package. An incremental package decompression and replacement unit, which is used to perform decompression and replacement on the incorporated subpackage resource to form an offline subpackage resource if the incorporation is successful. A download unit, which is used to modify the subpackage type to a whole package and download the whole package resource corresponding to the subpackage resource if the incorporation fails.

16. A terminal, characterized in that: It includes: A memory, which is used to store a computer program. A processor, which is used to implement the web resource access method according to any one of claims 1 to 8 when executing the computer program.

17. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the web page resource access method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Page loading processing method and device

    CN107203555A