WO2019041766A1 - 页面资源加载方法、装置、终端设备及介质 - Google Patents

页面资源加载方法、装置、终端设备及介质 Download PDF

Info

Publication number
WO2019041766A1
WO2019041766A1 PCT/CN2018/077044 CN2018077044W WO2019041766A1 WO 2019041766 A1 WO2019041766 A1 WO 2019041766A1 CN 2018077044 W CN2018077044 W CN 2018077044W WO 2019041766 A1 WO2019041766 A1 WO 2019041766A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
page
cache
value
plug
Prior art date
Application number
PCT/CN2018/077044
Other languages
English (en)
French (fr)
Inventor
黄伟淦
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019041766A1 publication Critical patent/WO2019041766A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • the present application belongs to the field of mobile application technologies, and in particular, to a page resource loading method, device, terminal device, and medium.
  • Hybrid App is an application written based on web language and programming language. From the user's point of view, the interface of the Hybrid App will be similar to the Native App, but in reality, the mobile app displays HTML5-based pages.
  • the embodiment of the present application provides a method, a device, a terminal device, and a medium for loading a page resource, so as to solve the problem that the Hybrid App takes a long time when loading a page resource for the first time.
  • a first aspect of the embodiment of the present application provides a page resource loading method, including:
  • the page load request is intercepted, and the page address carried by the page load request is obtained;
  • the static cache resource matching the page address is loaded according to a preset network view.
  • a second aspect of the embodiments of the present application provides a page resource loading apparatus, where the page resource loading apparatus includes a unit for performing the page resource loading method according to the above first aspect.
  • a third aspect of the embodiments of the present application provides a terminal device, including a memory and a processor, where the computer stores computer readable instructions executable on the processor, the processor executing the computer
  • the step of the page resource loading method as described in the first aspect is implemented when the instruction is read.
  • a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor to implement the first aspect as described in the first aspect The steps of the page resource loading method.
  • a page resource plug-in matching multiple sites is stored in the application installation package of the Hybrid App, and Hybrid is enabled.
  • the app intercepts the page load request, it runs the local page resource plugin to load the static cache resource matching the page load request, ensuring Hybrid
  • the App can quickly load page resources from the local area even when the page resources are first loaded, thereby reducing the number of requests for page resources to the remote server, greatly reducing the time-consuming loading of page resources, thereby improving Hybrid. App performance.
  • FIG. 1 is a flowchart of an implementation of a page resource loading method provided by an embodiment of the present application
  • FIG. 2 is a flowchart of an implementation of a page resource loading method according to another embodiment of the present application.
  • FIG. 3 is a flowchart of an implementation of a page resource loading method according to another embodiment of the present application.
  • FIG. 4 is a flowchart of a specific implementation of a page resource loading method S104 according to an embodiment of the present application
  • FIG. 5 is a structural block diagram of a page resource loading apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • the execution subject of the process is an application running on the mobile terminal, referred to as a mobile application.
  • the mobile app is a hybrid app Hybrid App.
  • FIG. 1 shows an implementation flow of a page resource loading method provided by an embodiment of the present application, where the method process includes steps S101 to S104.
  • the specific implementation principle of each step is as follows.
  • the moment when the mobile application loads the page resource includes the moment when the mobile application is started and the moment when the resource selection instruction sent by the user is received during the running of the mobile application.
  • the page load event is triggered.
  • the mobile app generates a page load request.
  • the interceptor preset by the mobile application detects the page load request, the page load request is intercepted and captured, so that the page load request cannot reach its destination address normally, that is, the page load request cannot be sent to the remote server and Unable to request to load page resources on a remote network.
  • the above page address may be, for example, a URL (Uniform Resoure Locator) address of a page resource stored on a remote server.
  • the page address can reflect information such as network transmission protocol, IP address, domain name address, path, and resource file name.
  • the page address carried by the intercepted page load request may be: local://www.abc.com/item/url/110640.
  • the network transmission protocol corresponding to the native page resource of the mobile application is usually a file protocol. Since the file protocol cannot be identified and intercepted, in the development process of the mobile application, the network transmission protocol corresponding to the native page resource is uniformly changed to Local protocol. The page load request is intercepted only when the protocol that detects the page address carried by the page load request is the local protocol.
  • S102 Determine, according to the site corresponding to the page address, a page resource plug-in that matches the site, where the page resource plug-in is pre-stored in an installation package of the application.
  • a site represents a virtual directory that organizes, maintains, and manages multiple page resources. According to the page address obtained in the above S101, the IP address part or the domain name address part in the page address is determined as the site corresponding to the page address.
  • the mobile application before the mobile application is started, it is required to perform installation processing on the mobile application based on the installation package of the mobile application downloaded in advance.
  • a page resource plugin for multiple sites is stored. Specifically, before the installation package of the mobile application is released, the page resources of each site related to the mobile application are integrated into one hfcache. Plugin and package it into the mobile app's installation package with the hfcache plugin.
  • Each hfcache plugin will retrieve a compressed package corresponding to the hfcache plugin and a list of cached files.
  • the file format of the above compressed package includes but is not limited to the .zip format or the .rar format.
  • the compressed package contains various static cache resources of the site, such as js files, css files, images, and audio files in the site.
  • the cache file list is used to record the resource name of each static cache resource in the compressed package and the MD5 value corresponding to each static cache resource. When each static cache resource is released, its MD5 value will be calculated by a preset algorithm. Integrate static cache resources into hfcache During the plugin process, its MD5 value will be recorded in hfcache The plugin corresponds to the list of cache files.
  • S104 In the application, loading the static cache resource that matches the page address according to a preset network view.
  • the resource path and the resource file name of the page resource loaded by the current mobile application are parsed.
  • a static cache resource matching the resource path and the resource file name is determined.
  • WebView is a webkit-based engine and a control for displaying web pages.
  • the static cache resource determined by the mobile application is parsed to generate a corresponding web page, thereby realizing the display of the page resource required for the page loading request.
  • a page resource plug-in matching multiple sites is stored in the application installation package of the Hybrid App, and Hybrid is enabled.
  • the app intercepts the page load request, it decompresses the local page resource plugin to load the static cache resource matching the page load request, ensuring Hybrid
  • the App can quickly load page resources from the local area even when the page resources are first loaded, thereby reducing the number of requests for page resources to the remote server, greatly reducing the time-consuming loading of page resources, thereby improving Hybrid. App performance.
  • the method further includes:
  • S105 Send a plug-in update detection request to the first server every preset time interval.
  • Static cache resources of different sites are usually maintained by different teams.
  • the embodiment of the present application provides a static cache resource publishing platform, and each team logs in through the login account. After the static cache resource is released from the platform, the updated static cache resource can be packaged and uploaded. After the page resource plugin is uploaded to the static cache resource publishing platform, the update of the page resource plugin is completed.
  • the above static cache resource publishing platform is referred to as a first server.
  • the mobile application sends a plug-in update detection request to the first server every preset time interval to detect whether the static cache resource stored locally is updated at the current time.
  • the foregoing S105 specifically includes:
  • the plug-in update detection request includes an identification number of the page resource plug-in, so that the first server is bound to the identification number In the plug-in resource page, the static cache resource published at the current moment is extracted, and the first server returns the first cache file list related to the static cache resource.
  • each page resource plug-in stored locally is pre-assigned with an identification number, that is, an ID number for uniquely identifying the page resource plug-in.
  • the mobile app needs to determine if a new version of each page resource plugin appears. Based on the ID number of the page resource plug-in to be detected, the mobile application sends a plug-in update detection request carrying the ID number to the first server.
  • the ID number of the page resource plug-in carried by the plug-in update detection request is parsed.
  • the first server filters out the page resource plug-in corresponding to the ID number in each page resource plug-in that is released at the current time.
  • the first server generates a first cache file list according to the static cache resource invoked by the filtered page resource plug-in, and records the resource name and the MD5 value of each static cache resource in the first cache file list, and the first cache The file list is returned to the mobile app as a response to the plugin update detection request.
  • the first server stores the resource homepage address corresponding to each ID number.
  • the first server crawls the page resources in the resource homepage address according to the stored resource homepage addresses. Consolidate the crawl results into a new page resource plugin and publish the page resource plugin.
  • the administrator of the site does not need to manually log in to the static cache resource publishing platform and manually upload the updated page resource plug-in, and only needs to store the resource home page address of the site in the first server, thereby implementing the page resource plug-in. Automatic crawling and scheduled updates, which reduces the operational complexity of the page resource plugin during the update release process.
  • S106 Receive a first cache file list returned by the first server according to the plug-in update detection request, where the first cache file list includes an MD5 value of each of the static cache resources.
  • S107 Read, in the second cache file list obtained by running the page resource plugin, an MD5 value of each of the static cache resources.
  • the cache file list obtained after running the locally stored page resource plugin is referred to as the second cache.
  • List of Documents It can be seen from the above step S103 that the second cache file list records the resource names of the static cache resources in the compressed package corresponding to the page resource plug-in and the MD5 value corresponding to each static cache resource.
  • the MD5 value corresponding to each resource name in the first cache file list is sequentially read.
  • the MD5 value corresponding to the resource name is found in the second cache file list. If the two MD5 values are different, it is determined that the static cache resource corresponding to the resource name is released with a new version.
  • the static cache resource is downloaded from the first server to update the static cache resource stored locally by the mobile application. And deleting the first cache file list originally stored by the mobile application to update the second cache file list to the first cache file list.
  • the mobile application when updating the static cache resource stored locally by the mobile application, only the incremental part of the static cache resource is downloaded from the first server, so as to reduce the amount of data that the mobile application needs to download, thereby improving the static cache resource. Update efficiency.
  • the first cache file list related to the newly released static cache resource is periodically obtained, and the MD5 value of the static cache resource in the second cache file list stored locally is determined in the first cache file list. Whether the MD5 value is the same, can quickly detect whether the static cache resource in the mobile application has released a new version, and improve the detection efficiency; the MD5 value of a static cache resource in the first cache file list is in the second cache When the MD5 value in the file list is different, by updating the static cache resource, downloading of the entire page resource plug-in with a large amount of information can be avoided, thereby improving the update efficiency of the static cache resource.
  • the method further includes:
  • S110 Perform decryption processing on the plurality of the static cache resources under the site stored locally by using the decryption algorithm.
  • the page resource plug-in of the installation package packaged into the mobile application, the static cache resource corresponding to each page resource plug-in, and the cache file list are file data encrypted based on AES (Advanced Encryption Standard).
  • AES Advanced Encryption Standard
  • the decryption algorithm is triggered to acquire an event to read a decryption algorithm pre-stored in the mobile application.
  • each encrypted static cache resource is decrypted to decrypt the compressed package corresponding to the page resource plug-in, the cache file list, and various static cache resources.
  • the static cache resource can be stored in the mobile terminal in an encrypted form by encrypting each data file such as a static cache resource.
  • the page load request is intercepted only when the mobile application is running, in order to obtain the decryption algorithm for decrypting the page resource plugin. Therefore, even if the static cache resource is intercepted by other criminals, as long as the mobile application is not running, the static cache resource is Can not be decrypted, thus ensuring the code security of static cache resources.
  • the foregoing S104 specifically includes:
  • S1041 Acquire, in the multiple static cache resources, the static cache resource that matches the page address, and calculate an MD5 value of the static cache resource.
  • a static cache resource matching the page address is searched.
  • the static cache resource obtained by the search is processed by the MD5 algorithm pre-stored locally to calculate the MD5 value of the static cache resource at the current time.
  • the MD5 algorithm stored locally is the same as the MD5 algorithm used by the first server to distribute the page resource plugin.
  • S1042 Read, in each MD5 value recorded in the second cache file list, an MD5 value corresponding to the static cache resource.
  • the MD5 value corresponding to the resource name is searched to determine whether the MD5 value obtained by the search is the same as the MD5 value calculated in real time at the current time.
  • the calculated MD5 value is the same as the MD5 value read in the second cache file list, it can be determined that the locally stored static cache resource is the latest published page resource and has not been tampered with, so the preset WebView is adopted. Load the static cache resource directly.
  • the intercepted page load request is resent to the resource server corresponding to the page address carried by it to request online access to the page resource.
  • the real-time MD5 value of the static cache resource is calculated by using the MD5 algorithm, and whether the MD5 value is the same as the MD5 value in the cache file list is compared, and the tamper-proof verification of the static cache resource is implemented;
  • the list may be updated before the file of the static cache resource. Therefore, if the calculated MD5 value is different from the MD5 value in the cache file list, it may be preliminarily determined that the locally stored static cache resource may be different from the latest version of the static cache resource. Therefore, by loading the page resources in real time online, it is ensured that the mobile application can maximize the loading speed of the page resources and display the latest version of the page resources, thereby improving the reliability of the mobile application.
  • FIG. 5 is a structural block diagram of a page resource loading apparatus provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
  • the apparatus includes: an intercepting unit 51, configured to: when a page loading event is triggered, intercept a page loading request, and obtain a page address carried by the page loading request; and the determining unit 52 is configured to a page resource corresponding to the page address, the page resource plug-in matching the site is determined, the page resource plug-in is pre-stored in the installation package of the application, and the decompressing unit 53 is configured to run the page resource plug-in to obtain the local storage.
  • the plurality of static cache resources under the site; the loading unit 54 is configured to load, in the application, the static cache resource that matches the page address according to a preset network view.
  • the page resource loading apparatus further includes: a requesting unit, configured to send a plug-in update detection request to the first server every preset time interval; and a receiving unit, configured to receive the first server according to the The plug-in update detects a first cache file list returned by the request, the first cache file list includes an MD5 value of each of the static cache resources, and a reading unit configured to execute the page resource plug-in In the second cache file list, the MD5 value of each of the static cache resources is read; an update unit is configured, for each of the static cache resources, if the MD5 value in the first cache file list is in the If the MD5 value in the second cache file list is different, the static cache resource is updated, and the second cache file list is updated to the first cache file list.
  • a requesting unit configured to send a plug-in update detection request to the first server every preset time interval
  • a receiving unit configured to receive the first server according to the The plug-in update detects a first cache file list returned by the request, the first cache file list includes an MD
  • the requesting unit includes: a requesting subunit, configured to send a plug-in update detection request to the first server every preset time interval, where the plug-in update detection request includes an identifier number of the page resource plug-in So that the first server extracts the static cache resource published at the current time in the plug-in resource page bound to the identification number, and causes the first server to return the first related to the static cache resource.
  • a requesting subunit configured to send a plug-in update detection request to the first server every preset time interval, where the plug-in update detection request includes an identifier number of the page resource plug-in So that the first server extracts the static cache resource published at the current time in the plug-in resource page bound to the identification number, and causes the first server to return the first related to the static cache resource.
  • a list of cached files configured to send a plug-in update detection request to the first server every preset time interval, where the plug-in update detection request includes an identifier number of the page resource plug-in So that the first server extracts the static
  • the page resource loading device further includes: an obtaining unit, configured to acquire a preset decryption algorithm; and a decryption unit, configured to, by using the decryption algorithm, a plurality of the statics under the locally stored site The cache resource is decrypted.
  • the loading unit 54 includes: a computing subunit, configured to acquire, in the multiple static cache resources, the static cache resource that matches the page address, and calculate an MD5 value of the static cache resource. Obtaining a subunit for reading an MD5 value corresponding to the static cache resource in each MD5 value pre-recorded in the second cache file list; loading the subunit for reading the MD5 value and If the calculated MD5 value is the same, the static cache resource is loaded according to the preset network view in the application, and the sending subunit is configured to: if the MD5 value obtained by reading is different from the calculated MD5 value, The page load request is sent to the second server to load a web page resource based on the page address.
  • a computing subunit configured to acquire, in the multiple static cache resources, the static cache resource that matches the page address, and calculate an MD5 value of the static cache resource.
  • FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 6 of this embodiment includes a processor 60, a memory 62, and computer readable instructions 62 stored in the memory 62 and executable on the processor 60, such as page resource loading. program.
  • the processor 60 executes the computer readable instructions 62, the steps in the foregoing various page resource loading method embodiments are implemented, such as steps 101 to 104 shown in FIG.
  • the processor 60 when executing the computer readable instructions 62, implements the functions of the various modules/units in the various apparatus embodiments described above, such as the functions of the units 51 through 54 shown in FIG.
  • the computer readable instructions 62 may be partitioned into one or more modules/units that are stored in the memory 62 and executed by the processor 60, To complete this application.
  • the one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer readable instructions 62 in the terminal device 6.
  • the terminal device 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor 60 and a memory 62. It will be understood by those skilled in the art that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation of the terminal device 6, and may include more or less components than those illustrated, or combine some components or different components.
  • the terminal device may further include an input/output device, a network access device, a bus, and the like.
  • the so-called processor 60 can be a central processing unit (Central Processing Unit, CPU), can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 62 includes at least one type of computer readable storage medium, which may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6.
  • the memory 62 may also be an external storage device of the terminal device 6, such as a plug-in hard disk equipped on the terminal device 6, a smart memory card (SMC), and a secure digital (SD). Card, flash card, etc.
  • the memory 62 may also include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 62 is configured to store the computer readable instructions and other programs and data required by the terminal device.
  • the memory 62 can also be used to temporarily store data that has been or will be output.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • a computer readable storage medium A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

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

Abstract

本方案提供了一种页面资源加载方法、装置、终端设备及介质,适用于移动应用技术领域,该方法包括:当页面加载事件被触发时,对页面加载请求进行拦截,并获取页面加载请求所携带的页面地址;基于页面地址对应的站点,确定与站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;运行页面资源插件,以得到本地存储的站点下的多个静态缓存资源;在应用程序中,根据预设的网络视图,加载与页面地址匹配的静态缓存资源。本方案保证了Hybrid App即使是在首次加载页面资源的情况之下,也能够从本地快速加载页面资源,从而减少了向第二服务器请求页面资源的次数,大大降低了页面资源的加载耗时,提高了Hybrid App的性能。

Description

页面资源加载方法、装置、终端设备及介质
本申请要求于2017年08月30日提交中国专利局、申请号为201710761478.X 、发明名称为“页面资源加载方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于移动应用技术领域,尤其涉及一种页面资源加载方法、装置、终端设备及介质。
背景技术
随着技术的不断更新,移动终端的应用程序也逐渐地沿着本地化应用(Native App),到基于WEB的应用(Web App),再到混合型应用(Hybrid APP)的方向发展。Hybrid App为基于网页语言与程序语言来编写的应用。从用户的角度来看,Hybrid App的界面会类似于 Native App,但实际上,移动应用所展示的是基于HTML5的页面。
在Hybrid App的开发过程中,若HTML5页面没有得到完善的优化处理,则在网络环境较差的情况之下,用户在使用Hybrid App并首次加载页面资源时,往往需要较大的耗时才能获取页面资源。统计发现,Hybrid App在3g或2g的网络环境之下,页面资源在首次加载时所消耗的时间甚至超过了一分钟,这导致了Hybrid App的性能极为低下。
技术问题
有鉴于此,本申请实施例提供了一种页面资源加载方法、装置、终端设备及介质,以解决现有技术中Hybrid App在首次加载页面资源时耗时较大的问题。
技术解决方案
本申请实施例的第一方面提供了一种页面资源加载方法,包括:
当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;
基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;
运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;
在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
本申请实施例的第二方面提供了一种页面资源加载装置,该页面资源加载装置包括用于执行上述第一方面所述的页面资源加载方法的单元。
本申请实施例的第三方面提供了一种终端设备,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如第一方面所述的页面资源加载方法的步骤。
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如第一方面所述的页面资源加载方法的步骤。
有益效果
本申请实施例中,通过在Hybrid App的应用程序安装包中存入与多个站点匹配的页面资源插件,并使Hybrid App在拦截到页面加载请求时,运行存储于本地的页面资源插件,以加载与页面加载请求匹配的静态缓存资源,保证了Hybrid App即使是在首次加载页面资源的情况之下,也能够从本地快速加载页面资源,从而减少了向远程服务器请求页面资源的次数,大大降低了页面资源的加载耗时,由此也提高了Hybrid App的性能。
附图说明
图1是本申请实施例提供的页面资源加载方法的实现流程图;
图2是本申请另一实施例提供的页面资源加载方法的实现流程图;
图3是本申请又一实施例提供的页面资源加载方法的实现流程图;
图4是本申请实施例提供的页面资源加载方法S104的具体实现流程图;
图5是本申请实施例提供的页面资源加载装置的结构框图;
图6是本申请实施例提供的终端设备的示意图。
本发明的实施方式
在本申请的各个实施例中,流程的执行主体为运行于移动终端上的应用程序,简称移动应用。该移动应用为混合型应用Hybrid App。
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。
图1示出了本申请实施例提供的页面资源加载方法的实现流程,该方法流程包括步骤S101至S104。各步骤的具体实现原理如下。
S101:当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址。
移动应用加载页面资源的时刻包括移动应用启动的时刻以及在移动应用的运行过程中,接收到用户发出的资源选取指令的时刻。在上述情况下,页面加载事件即被触发。此时,移动应用生成页面加载请求。当预设于移动应用的拦截器检测到该页面加载请求时,将页面加载请求进行拦截及捕获,以使页面加载请求无法正常到达其目的地址,即,使得页面加载请求无法发送至远程服务器以及无法请求加载远程网络上的页面资源。
对当前时刻所拦截的页面加载请求进行解析,以提取页面加载请求所携带的页面地址。上述页面地址例如可以是存储于远程服务器上的页面资源的URL(Uniform Resoure Locator,统一资源定位符)地址。页面地址中可以体现出网络传输协议、IP地址、域名地址、路径以及资源文件名等信息。
示例性地,拦截得到的页面加载请求所携带的页面地址可以是:local://www.abc.com/item/url/110640。
优选地,移动应用的原生页面资源所对应的网络传输协议通常为file协议,由于file协议无法被识别拦截,故在移动应用的开发过程中,将原生页面资源所对应的网络传输协议统一更改为local协议。仅在检测到页面加载请求所携带的页面地址的协议为local协议时,才对页面加载请求进行拦截。
S102:基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中。
站点表示对多个页面资源进行组织、维护和管理的虚拟目录。根据上述S101所获取得到的页面地址,将页面地址中的IP地址部分或域名地址部分确定为该页面地址所对应的站点。
例如,在上述页面地址http://www.abc.com/item/url/110640中,解析得到的域名地址为“www.abc.com”,故该页面地址对应的站点为www.abc.com站点。
本申请实施例中,在移动应用启动之前,需要基于预先下载的移动应用的安装包,对该移动应用进行安装处理。在下载的安装包中,存储有多个站点的页面资源插件。具体地,在发布移动应用的安装包前,与该移动应用相关的每一站点的页面资源将整合为一hfcache 插件,并以该hfcache 插件打包至移动应用的安装包中。
当移动应用安装成功后,从安装包中获取各个页面资源插件。根据每一页面资源插件的插件名以及上述页面加载请求所对应的站点,从整合于安装包的各个页面资源插件中,确定出与站点匹配的页面资源插件。
S103:运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源。
每一个hfcache 插件运行时,将调取与该hfcache 插件对应的一压缩包以及一缓存文件清单。上述压缩包的文件格式包括但不限于.zip格式或.rar格式。压缩包中包含有站点的各项静态缓存资源,如站点中的js文件、css文件、图片以及音频等文件。缓存文件清单用于记录压缩包中各项静态缓存资源的资源名称以及每一静态缓存资源所对应的MD5值。每一静态缓存资源在发布时,将通过预设算法计算其MD5值。在将静态缓存资源整合至hfcache 插件的过程中,其MD5值将记录于hfcache 插件对应的缓存文件清单中。
将hfcache 插件对应的压缩包进行解压,可得到各个存储路径下的静态缓存资源。
S104:在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
从页面加载请求所携带的页面地址中,解析出当前移动应用所需加载的页面资源的资源路径以及资源文件名。在解压得到的各项静态缓存资源中,确定出与该资源路径以及资源文件名匹配的静态缓存资源。
WebView是一个基于webkit引擎以及用于展现web页面的控件。本申请实施例中,通过移动应用内部预设的WebView,对确定出的静态缓存资源进行解析,以生成相应的Web页面,从而实现对页面加载请求所需的页面资源的展示。
本申请实施例中,通过在Hybrid App的应用程序安装包中存入与多个站点匹配的页面资源插件,并使Hybrid App在拦截到页面加载请求时,解压存储于本地的页面资源插件,以加载与页面加载请求匹配的静态缓存资源,保证了Hybrid App即使是在首次加载页面资源的情况之下,也能够从本地快速加载页面资源,从而减少了向远程服务器请求页面资源的次数,大大降低了页面资源的加载耗时,由此也提高了Hybrid App的性能。
作为本申请的另一个实施例,如图2所示,在上述S104之后,还包括:
S105:每隔预设的时间间隔,向第一服务器发出插件更新检测请求。
不同站点的静态缓存资源通常由不同的团队来维护更新,为了便于移动应用更新本地存储的各个站点的静态缓存资源,本申请实施例提供了一静态缓存资源发布平台,各个团队通过其登录账号登录该静态缓存资源发布平台后,即可将更新后的静态缓存资源打包上传。将页面资源插件上传至静态缓存资源发布平台后,即完成了页面资源插件的更新发布。为了便于理解以及区分于下文所提到的远程服务器,将上述静态缓存资源发布平台称为第一服务器。
移动应用每隔预设的时间间隔,向第一服务器发出插件更新检测请求,以检测当前时刻本地所存储的静态缓存资源是否出现更新。
作为本申请的一个实施例,上述S105具体包括:
每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
本申请实施例中,本地所存储的每一页面资源插件预先分配有一个标识号,即用于唯一标识页面资源插件的ID号。每隔预设的时间间隔,移动应用需确定各个页面资源插件是否出现新版本。基于所需检测的页面资源插件的ID号,移动应用向第一服务器发出携带该ID号的插件更新检测请求。
当第一服务器接收到插件更新检测请求时,解析出插件更新检测请求所携带的页面资源插件的ID号。第一服务器在当前时刻所发布的各个页面资源插件中,筛选出与该ID号对应的页面资源插件。根据筛选出的页面资源插件所调用的静态缓存资源,第一服务器生成第一缓存文件清单,以将各项静态缓存资源的资源名称以及MD5值记录于第一缓存文件清单,并将第一缓存文件清单作为插件更新检测请求的响应信息,返回至移动应用。
优选地,第一服务器中存储有各个ID号所对应的资源主页地址,在预设时间间隔到达时,第一服务器根据其所存储的各个资源主页地址,爬取资源主页地址中的页面资源,以将爬取结果整合为新的页面资源插件,并将该页面资源插件进行发布。本申请实施例中,站点的管理人员无须人工登录静态缓存资源发布平台并人工上传更新后的页面资源插件,只需将站点的资源主页地址存储于第一服务器中,便可实现页面资源插件的自动爬取及定时更新,由此降低了页面资源插件在更新发布过程中的操作复杂度。
S106:接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值。
S107:在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值。
运行本地存储的页面资源插件后,同样可获得一缓存文件清单,为了区别于第一服务器所返回的缓存文件清单,将运行本地存储的页面资源插件后所获得的缓存文件清单称为第二缓存文件清单。由上述步骤S103可知,第二缓存文件清单记录有页面资源插件所对应的压缩包中各项静态缓存资源的资源名称以及每一静态缓存资源所对应的MD5值。
S108:对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
依次读取第一缓存文件清单中每一资源名称所对应的MD5值。其中,在读取每一资源名称所对应的MD5值时,在第二缓存文件清单中,查找出与该资源名称对应的MD5值。若这两个MD5值不相同,则确定该资源名称所对应的静态缓存资源发布了新的版本。
特别地,若第一缓存文件清单中的某一资源名称不存在于第二缓存文件清单,则同样确定该资源名称所对应的静态缓存资源发布了新的版本。
在确定某一静态缓存资源发布了新的版本时,从第一服务器中,下载该静态缓存资源,以更新移动应用本地所存储的静态缓存资源。并且,将移动应用原本所存储的第一缓存文件清单进行删除,以将第二缓存文件清单更新为第一缓存文件清单。
优选地,在更新移动应用本地所存储的静态缓存资源时,仅从第一服务器中下载静态缓存资源的增量部分数据,以减少移动应用所需下载的数据量,从而提高了静态缓存资源的更新效率。
本申请实施例中,通过定时获取与最新发布的静态缓存资源相关的第一缓存文件清单,并判断本地所存储的第二缓存文件清单中静态缓存资源的MD5值与该第一缓存文件清单中的MD5值是否相同,能够迅速地检测出移动应用中的静态缓存资源是否发布了新版本,提高了检测效率;在某一静态缓存资源在第一缓存文件清单中的MD5值与其在第二缓存文件清单中的MD5值不同时,通过更新该静态缓存资源,能够避免对信息量较大的整个页面资源插件的下载,由此提高了静态缓存资源的更新效率。
作为本申请的又一个实施例,如图3所示,在上述S103之后,还包括:
S109:获取预设的解密算法。
S110:通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
本申请实施例中,打包至移动应用的安装包的页面资源插件、每一页面资源插件所对应的静态缓存资源以及缓存文件清单均为基于AES(Advanced Encryption Standard,高级加密标准)加密的文件数据。当移动应用处于运行状态,且拦截到页面加载请求后,触发解密算法获取事件,以读取预存储于移动应用中的解密算法。通过该解密算法,对加密的各个静态缓存资源进行解密处理,以解密出页面资源插件所对应的压缩包、缓存文件清单以及各项静态缓存资源。
本申请实施例中,在对页面资源插件以及应用程序进行打包的同时,通过对静态缓存资源等各项数据文件进行加密,使得静态缓存资源能够以加密的形式保存在移动终端中。只有在移动应用运行时,才拦截页面加载请求,才能获取用于解密页面资源插件的解密算法,因此,即使静态缓存资源被其他不法分子拦截,只要移动应用未处于运行状态,则静态缓存资源就无法被解密,因而保证了静态缓存资源的代码安全。
作为本申请的一个实施例,如图5所示,上述S104具体包括:
S1041:在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值。
本申请实施例中,根据页面加载请求所携带的页面地址,在解压后的各个静态缓存资源中,搜索与该页面地址匹配的静态缓存资源。通过预存储于本地的MD5算法,对搜索得到的静态缓存资源进行处理,以计算出该静态缓存资源在当前时刻的MD5值。其中,本地所存储的MD5算法与第一服务器在分布页面资源插件时所使用的MD5算法相同。
S1042:在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值。
根据该静态缓存资源的资源名称,在本地存储的缓存文件清单中,查找该资源名称所对应的MD5值,以判断查找得到的MD5值与当前时刻所实时计算出的MD5值是否相同。
S1043:若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源。
S1044:若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
不同的数据内容,其通过同一MD5算法计算得到的MD5值是不同的。因此,如果当前时刻存储于本地的静态缓存资源发生了变化,或者缓存文件清单所记录的静态缓存资源的MD5值是最新发布的MD5值,那么通过MD5算法计算得到的MD5值将与缓存文件清单中所存储的MD5值不同,从而可以判断出本地存储的静态缓存资源是否被篡改或者是否为最新版本的页面资源。
若计算得到的MD5值与第二缓存文件清单中所读取到的MD5值相同,则可判定本地存储的静态缓存资源是最新发布的页面资源,且未被篡改,故通过预设的WebView,直接加载该静态缓存资源。
若计算得到的MD5值与第二缓存文件清单中所读取到的MD5值不同,则可判定本地存储的静态缓存资源是旧版本的页面资源,或者已被非法篡改。此时,将拦截得到的页面加载请求重新发送至与其所携带的页面地址相对应的资源服务器,以请求在线获取页面资源。
本申请实施例中,通过使用MD5算法来计算静态缓存资源的实时MD5值,并对比该MD5值与缓存文件清单中的MD5值是否相同,实现了静态缓存资源的防篡改校验;由于缓存文件清单可能先于静态缓存资源的文件本身出现更新,因而若计算得到的MD5值与缓存文件清单中的MD5值不同,则可初步判断出本地存储的静态缓存资源可能与最新版本的静态缓存资源不同,故通过在线实时加载页面资源,保证了移动应用能够最大限度提高页面资源加载速度的同时,展示最新版本的页面资源,从而提高了移动应用的可靠性。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的页面资源加载方法,图5示出了本申请实施例提供的页面资源加载装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图5,该装置包括:拦截单元51,用于当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;确定单元52,用于基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;解压单元53,用于运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;加载单元54,用于在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
可选地,所述页面资源加载装置还包括:请求单元,用于每隔预设的时间间隔,向第一服务器发出插件更新检测请求;接收单元,用于接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值;读取单元,用于在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值;更新单元,用于对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
可选地,所述请求单元包括:请求子单元,用于每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
可选地,所述页面资源加载装置还包括:获取单元,用于获取预设的解密算法;解密单元,用于通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
可选地,所述加载单元54包括:计算子单元,用于在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值;获取子单元,用于在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值;加载子单元,用于若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源;发送子单元,用于若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
图6是本申请一实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备6包括:处理器60、存储器62以及存储在所述存储器62中并可在所述处理器60上运行的计算机可读指令62,例如页面资源加载程序。所述处理器60执行所述计算机可读指令62时实现上述各个页面资源加载方法实施例中的步骤,例如图1所示的步骤101至104。或者,所述处理器60执行所述计算机可读指令62时实现上述各装置实施例中各模块/单元的功能,例如图5所示单元51至54的功能。
示例性的,所述计算机可读指令62可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器62中,并由所述处理器60执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令62在所述终端设备6中的执行过程。
所述终端设备6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器60、存储器62。本领域技术人员可以理解,图6仅仅是终端设备6的示例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器62至少包括一种类型的计算机可读存储介质,可以是所述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。所述存储器62也可以是所述终端设备6的外部存储设备,例如所述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器62还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器62用于存储所述计算机可读指令以及所述终端设备所需的其他程序和数据。所述存储器62还可以用于暂时地存储已经输出或者将要输出的数据。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种页面资源加载方法,其特征在于,包括:
    当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;
    基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;
    运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;
    在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
  2. 如权利要求1所述的页面资源加载方法,其特征在于,还包括:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求;
    接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值;
    在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值;
    对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
  3. 如权利要求2所述的页面资源加载方法,其特征在于,所述每隔预设的时间间隔,向第一服务器发出插件更新检测请求,包括:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
  4. 如权利要求1所述的页面资源加载方法,其特征在于,在所述运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源之后,还包括:
    获取预设的解密算法;
    通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
  5. 如权利要求2所述的页面资源加载方法,其特征在于,所述在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源,包括:
    在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值;
    在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值;
    若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源;
    若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
  6. 一种页面资源加载装置,其特征在于,包括:
    拦截单元,用于当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;
    确定单元,用于基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;
    解压单元,用于运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;
    加载单元,用于在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
  7. 根据权利要求6所述的页面资源加载装置,其特征在于,还包括:
    请求单元,用于每隔预设的时间间隔,向第一服务器发出插件更新检测请求;
    接收单元,用于接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值;
    读取单元,用于在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值;
    更新单元,用于对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
  8. 根据权利要求7所述的页面资源加载装置,其特征在于,所述请求单元包括:
    请求子单元,用于每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
  9. 根据权利要求6所述的页面资源加载装置,其特征在于,还包括:
    获取单元,用于获取预设的解密算法;
    解密单元,用于通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
  10. 根据权利要求7所述的页面资源加载装置,其特征在于,所述加载单元包括:
    计算子单元,用于在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值;
    获取子单元,用于在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值;
    加载子单元,用于若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源;
    发送子单元,用于若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
  11. 一种终端设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
    当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;
    基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;
    运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;
    在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
  12. 根据权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机可读指令时,还实现如下步骤:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求;
    接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值;
    在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值;
    对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
  13. 根据权利要求12所述的终端设备,其特征在于,所述每隔预设的时间间隔,向第一服务器发出插件更新检测请求,包括:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
  14. 根据权利要求11所述的终端设备,其特征在于,所述处理器执行所述计算机可读指令时,还实现如下步骤:
    获取预设的解密算法;
    通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
  15. 根据权利要求12所述的终端设备,其特征在于,所述在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源,包括:
    在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值;
    在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值;
    若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源;
    若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    当页面加载事件被触发时,对页面加载请求进行拦截,并获取所述页面加载请求所携带的页面地址;
    基于所述页面地址对应的站点,确定与所述站点匹配的页面资源插件,所述页面资源插件预先存储于应用程序的安装包中;
    运行所述页面资源插件,以得到本地存储的所述站点下的多个静态缓存资源;
    在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源。
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时,还实现如下步骤:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求;
    接收所述第一服务器根据所述插件更新检测请求所返回的第一缓存文件清单,所述第一缓存文件清单包含有每一所述静态缓存资源的MD5值;
    在运行所述页面资源插件所得到的第二缓存文件清单中,读取每一所述静态缓存资源的MD5值;
    对于每一所述静态缓存资源,若其在所述第一缓存文件清单中的MD5值与其在所述第二缓存文件清单中的MD5值不同,则更新该静态缓存资源,并将所述第二缓存文件清单更新为所述第一缓存文件清单。
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述每隔预设的时间间隔,向第一服务器发出插件更新检测请求,包括:
    每隔预设的时间间隔,向第一服务器发出插件更新检测请求,所述插件更新检测请求包含有所述页面资源插件的标识号,以使所述第一服务器在与所述标识号绑定的插件资源页面中,提取当前时刻所发布的静态缓存资源,并使所述第一服务器返回与该静态缓存资源相关的所述第一缓存文件清单。
  19. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时,还实现如下步骤:
    获取预设的解密算法;
    通过所述解密算法,对本地存储的所述站点下的多个所述静态缓存资源进行解密处理。
  20. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述在所述应用程序中,根据预设的网络视图,加载与所述页面地址匹配的所述静态缓存资源,包括:
    在所述多个静态缓存资源中,获取与所述页面地址匹配的所述静态缓存资源,并计算该静态缓存资源的MD5值;
    在预先记录于所述第二缓存文件清单的各个MD5值中,读取与该静态缓存资源对应的MD5值;
    若读取得到的MD5值与计算得到的MD5值相同,则在所述应用程序中,根据预设的网络视图,加载该静态缓存资源;
    若读取得到的MD5值与计算得到的MD5值不同,则向第二服务器发送所述页面加载请求,以加载基于所述页面地址的网络页面资源。
PCT/CN2018/077044 2017-08-30 2018-02-23 页面资源加载方法、装置、终端设备及介质 WO2019041766A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710761478.XA CN107729352B (zh) 2017-08-30 2017-08-30 页面资源加载方法及终端设备
CN201710761478.X 2017-08-30

Publications (1)

Publication Number Publication Date
WO2019041766A1 true WO2019041766A1 (zh) 2019-03-07

Family

ID=61205544

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077044 WO2019041766A1 (zh) 2017-08-30 2018-02-23 页面资源加载方法、装置、终端设备及介质

Country Status (2)

Country Link
CN (1) CN107729352B (zh)
WO (1) WO2019041766A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825603A (zh) * 2019-11-01 2020-02-21 北京博睿宏远数据科技股份有限公司 页面首次加载时间确定方法、装置、电子设备及存储介质

Families Citing this family (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804082A (zh) * 2018-05-10 2018-11-13 北京酷我科技有限公司 一种插件化JSBridge的实现方法
CN110825990A (zh) * 2018-07-23 2020-02-21 优视科技有限公司 页面访问方法、客户端、服务器及系统
CN110874445A (zh) * 2018-08-31 2020-03-10 中国移动通信集团浙江有限公司 网页加载方法、客户端及业务服务中心
CN109324838B (zh) * 2018-08-31 2022-05-10 深圳市元征科技股份有限公司 单片机程序的执行方法、执行装置及终端
CN109257426B (zh) * 2018-09-26 2022-10-14 平安普惠企业管理有限公司 业务线资源加载方法、装置、计算机设备和存储介质
CN109446449B (zh) * 2018-10-09 2022-05-10 南京尚网网络科技有限公司 一种预先刷新资讯页面内容的方法及设备
CN109408232B (zh) * 2018-10-17 2020-08-14 山东易通发展集团有限公司 一种基于交易流程的组件化总线调用执行系统
CN109582889A (zh) * 2018-10-17 2019-04-05 平安普惠企业管理有限公司 图片加载方法、装置、计算机设备及存储介质
CN109697069B (zh) * 2018-11-26 2022-07-26 福建天泉教育科技有限公司 一种h5应用的打包方法及终端
CN111310084A (zh) * 2018-12-12 2020-06-19 北京嘀嘀无限科技发展有限公司 页面加载方法、装置、系统、用户终端及可读存储介质
CN109800367A (zh) * 2018-12-13 2019-05-24 平安科技(深圳)有限公司 网页加载方法、装置、计算机设备及存储介质
CN109710870A (zh) * 2018-12-27 2019-05-03 北京微播视界科技有限公司 H5页面的加载方法、装置、电子设备及可读存储介质
CN109857960A (zh) * 2019-01-14 2019-06-07 厦门美柚信息科技有限公司 一种页面数据更新的方法、设备、系统及其存储介质
CN109934014B (zh) * 2019-02-15 2021-06-25 福建天泉教育科技有限公司 一种检测资源文件正确性的方法及终端
CN110058873B (zh) * 2019-03-12 2021-09-17 天津五八到家科技有限公司 应用页面更新方法、装置、设备和存储介质
CN110059276A (zh) * 2019-03-12 2019-07-26 天津五八到家科技有限公司 页面更新方法、装置、设备和存储介质
CN110008118B (zh) * 2019-03-13 2023-03-10 深圳壹账通智能科技有限公司 页面数据测试方法、装置、计算机设备和存储介质
CN110119290A (zh) * 2019-04-12 2019-08-13 平安科技(深圳)有限公司 应用程序备用页面切换方法、装置、计算机设备和存储介质
CN110377360A (zh) * 2019-07-12 2019-10-25 深圳市酷开网络科技有限公司 webview快速加载的方法、显示终端及计算机可读存储介质
CN110362770A (zh) * 2019-07-17 2019-10-22 吉旗(成都)科技有限公司 一种解决移动端web数据离线缓存的方法
CN111400630A (zh) * 2020-02-26 2020-07-10 中国平安人寿保险股份有限公司 资源预加载方法及相关设备
EP4229527A4 (en) 2020-10-14 2024-04-17 Vidaa USA, Inc. PAGE LOADING METHOD AND DISPLAY APPARATUS
CN112487322B (zh) * 2020-12-16 2024-05-28 Vidaa美国公司 一种第三方应用Loading页面的加载方法及显示设备
CN112751917A (zh) * 2020-12-28 2021-05-04 锐捷网络股份有限公司 资源文件加载方法、网络设备、电子设备及存储介质
CN113590618B (zh) * 2021-07-19 2023-10-13 上海淇玥信息技术有限公司 一种零访问量页面资源的清理方法、装置和电子设备
CN113626106A (zh) * 2021-08-19 2021-11-09 吉林亿联银行股份有限公司 数据拦截的实现方法及系统
CN114398099A (zh) * 2022-01-04 2022-04-26 北京金山云网络技术有限公司 程序资源加载方法、装置、设备及存储介质
CN114416212A (zh) * 2022-01-30 2022-04-29 中国工商银行股份有限公司 移动端应用程序数据资源处理方法及装置
CN114528529A (zh) * 2022-02-15 2022-05-24 广州经传多赢投资咨询有限公司 一种内存xml文件加密方法
CN115242775A (zh) * 2022-07-04 2022-10-25 中国银联股份有限公司 资源文件获取方法、装置、设备、介质及产品
CN117407115B (zh) * 2023-12-15 2024-02-20 江苏金融租赁股份有限公司 一种基于动态加载插件的界面显示方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150039713A1 (en) * 2013-08-05 2015-02-05 Phantom Technologies, Inc. Content caching
CN105208127A (zh) * 2015-10-09 2015-12-30 上海瀚银信息技术有限公司 一种网页缓存处理方法及系统以及智能终端
CN105630981A (zh) * 2015-12-25 2016-06-01 小米科技有限责任公司 网络资源加载与配置方法及装置
CN105988846A (zh) * 2015-03-03 2016-10-05 腾讯科技(深圳)有限公司 页面加载方法及页面加载装置
CN106951323A (zh) * 2017-03-09 2017-07-14 深圳峰创智诚科技有限公司 应用程序本地缓存方法和装置
CN107291519A (zh) * 2017-08-09 2017-10-24 四川长虹电器股份有限公司 一种基于移动终端的webview的跨平台图片缓存实现方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104572777B (zh) * 2013-10-28 2019-05-14 腾讯科技(深圳)有限公司 基于UIWebView组件的网页加载方法及装置
CN106209925B (zh) * 2015-04-29 2019-07-26 阿里巴巴集团控股有限公司 页面加载方法、客户端及系统
CN105653933B (zh) * 2016-01-06 2019-04-30 北京京东尚科信息技术有限公司 插件加载方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150039713A1 (en) * 2013-08-05 2015-02-05 Phantom Technologies, Inc. Content caching
CN105988846A (zh) * 2015-03-03 2016-10-05 腾讯科技(深圳)有限公司 页面加载方法及页面加载装置
CN105208127A (zh) * 2015-10-09 2015-12-30 上海瀚银信息技术有限公司 一种网页缓存处理方法及系统以及智能终端
CN105630981A (zh) * 2015-12-25 2016-06-01 小米科技有限责任公司 网络资源加载与配置方法及装置
CN106951323A (zh) * 2017-03-09 2017-07-14 深圳峰创智诚科技有限公司 应用程序本地缓存方法和装置
CN107291519A (zh) * 2017-08-09 2017-10-24 四川长虹电器股份有限公司 一种基于移动终端的webview的跨平台图片缓存实现方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825603A (zh) * 2019-11-01 2020-02-21 北京博睿宏远数据科技股份有限公司 页面首次加载时间确定方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN107729352B (zh) 2020-07-31
CN107729352A (zh) 2018-02-23

Similar Documents

Publication Publication Date Title
WO2019041766A1 (zh) 页面资源加载方法、装置、终端设备及介质
US11658985B2 (en) Utilizing blockchains to implement named data networking
CN106936793B (zh) 一种信息拦截处理方法及终端
EP3794487B1 (en) Obfuscation and deletion of personal data in a loosely-coupled distributed system
CN111143869B (zh) 应用程序包处理方法、装置、电子设备及存储介质
US8214903B2 (en) Analysis of scripts
US8433906B2 (en) Method and system for microlocking web content
US9578044B1 (en) Detection of anomalous advertising content
US10902094B2 (en) File origin determination
JP2017504850A (ja) 接続された装置のデータ管理
US9716771B2 (en) Cache control for web application resources
WO2019201040A1 (zh) 一种管理更新文件的方法、系统及终端设备
CN111163094B (zh) 网络攻击检测方法、网络攻击检测装置、电子设备和介质
US9665732B2 (en) Secure Download from internet marketplace
US11201728B1 (en) Data leakage mitigation with a blockchain
JP6169497B2 (ja) 接続先情報判定装置、接続先情報判定方法、及びプログラム
US10554682B2 (en) Detecting and removing injected elements from content interfaces
US9621630B2 (en) Distribution method, distribution apparatus, and terminal apparatus
JP6378808B2 (ja) 接続先情報判定装置、接続先情報判定方法、及びプログラム
CN108604273A (zh) 防止恶意软件下载
US20160337318A1 (en) Anti-tampering system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18852046

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18852046

Country of ref document: EP

Kind code of ref document: A1