Movatterモバイル変換


[0]ホーム

URL:


CN117193907B - Page processing method and device - Google Patents

Page processing method and device
Download PDF

Info

Publication number
CN117193907B
CN117193907BCN202311086973.7ACN202311086973ACN117193907BCN 117193907 BCN117193907 BCN 117193907BCN 202311086973 ACN202311086973 ACN 202311086973ACN 117193907 BCN117193907 BCN 117193907B
Authority
CN
China
Prior art keywords
page
address
resource
code file
resource address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311086973.7A
Other languages
Chinese (zh)
Other versions
CN117193907A (en
Inventor
林旭冬
谢凯森
关卓华
陈立豪
梁澍
张翔
胡裕源
沈乃严
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Internet Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Internet Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Internet Co LtdfiledCriticalChina Mobile Communications Group Co Ltd
Priority to CN202311086973.7ApriorityCriticalpatent/CN117193907B/en
Publication of CN117193907ApublicationCriticalpatent/CN117193907A/en
Application grantedgrantedCritical
Publication of CN117193907BpublicationCriticalpatent/CN117193907B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

The application provides a page processing method and a page processing device, and relates to the technical field of Internet. The specific scheme is as follows: the method comprises the steps of storing relevant resources corresponding to a preloaded page in a local storage, and carrying out identification modification on an original resource address corresponding to a page to be displayed under the condition that the resources corresponding to the page to be displayed are stored locally, so as to obtain a second resource address containing a preset identification, so that interception of sending a request for obtaining relevant resources to a server is realized based on whether the second resource address contains the preset identification, and the resources are directly obtained from the local storage. Thereby improving the efficiency of page processing.

Description

Translated fromChinese
页面处理方法及装置Page processing method and device

技术领域Technical Field

本申请涉及互联网技术领域,尤其涉及页面处理方法及装置。The present application relates to the field of Internet technology, and in particular to a page processing method and device.

背景技术Background Art

移动终端上的应用程序对超文本标记语言(html)页面的使用需求与日俱增,但是加载html页面资源的速度较低,从而导致用户体验较差。因此,如何提高终端设备对html页面资源的加载速度,是目前亟需解决的问题。The demand for the use of Hypertext Markup Language (HTML) pages by applications on mobile terminals is increasing day by day, but the speed of loading HTML page resources is low, resulting in a poor user experience. Therefore, how to improve the loading speed of HTML page resources by terminal devices is a problem that needs to be solved urgently.

发明内容Summary of the invention

本申请提供了一种页面处理方法及装置。The present application provides a page processing method and device.

根据本申请的一方面,提供了一种页面处理方法,包括:According to one aspect of the present application, a page processing method is provided, comprising:

响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表;In response to the application being started, obtaining a first page address list of preloaded pages corresponding to the application;

基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源;Preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address;

针对获取的应用程序待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中原资源地址标识修改后的第二资源地址;For the obtained second page address of the page to be displayed of the application, when the second response data corresponding to the second page address is matched from each first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address and the second resource address after the original resource address identifier in the second page code file is modified based on the verification result;

在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源;In a case where the identifier corresponding to the second resource address is a preset identifier, matching the resource corresponding to the second resource address from the locally stored resources corresponding to the first resource addresses;

基于第二资源地址对应的资源进行待展示页面的渲染。The page to be displayed is rendered based on the resource corresponding to the second resource address.

根据本申请的另一方面,提供了一种页面处理装置,包括:According to another aspect of the present application, a page processing device is provided, comprising:

获取模块,用于响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表;An acquisition module, used for responding to the start of an application program and acquiring a first page address list of preloaded pages corresponding to the application program;

预加载模块,用于基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源;A preloading module is used to preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address;

校验模块,用于针对获取的应用程序待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中原资源地址标识修改后的第二资源地址;A verification module, for obtaining a second page address of a page to be displayed in the application program, and verifying the second response data when second response data corresponding to the second page address is matched from each first response data stored locally, so as to obtain a second page code file corresponding to the second page address and a second resource address after the original resource address identifier in the second page code file is modified based on the verification result;

确定模块,用于在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源;A determination module, configured to match a resource corresponding to the second resource address from the locally stored resources corresponding to the first resource addresses when the identifier corresponding to the second resource address is a preset identifier;

渲染模块,用于基于第二资源地址对应的资源进行待展示页面的渲染。A rendering module is used to render the page to be displayed based on the resource corresponding to the second resource address.

根据本申请的另一方面,提供了一种电子设备,包括:According to another aspect of the present application, there is provided an electronic device, including:

至少一个处理器;以及at least one processor; and

与至少一个处理器通信连接的存储器;其中,a memory communicatively connected to at least one processor; wherein,

存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述实施例的方法。The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor so that the at least one processor can execute the method of the above embodiment.

根据本申请的另一方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,计算机指令用于使计算机执行根据上述实施例的方法。According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method according to the above embodiment.

应当理解,本部分所描述的内容并非旨在标识本申请的实施例的关键或重要特征,也不用于限制本申请的范围。本申请的其它特征将通过以下的说明书而变得容易理解。It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

附图用于更好地理解本方案,不构成对本申请的限定。其中:The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

图1为本申请实施例提供的一种页面处理方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a page processing method provided in an embodiment of the present application;

图2为本申请实施例提供的另一种页面处理方法的流程示意图;FIG2 is a flow chart of another page processing method provided in an embodiment of the present application;

图3为本申请实施例提供的另一种页面处理方法的流程示意图;FIG3 is a flow chart of another page processing method provided in an embodiment of the present application;

图4为本申请实施例提供的另一种页面处理装置的结构示意图;FIG4 is a schematic diagram of the structure of another page processing device provided in an embodiment of the present application;

图5为本申请实施例提供的一种电子设备的结构示意图。FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

下面参考附图,对本申请实施例的页面处理方法、装置、电子设备和存储介质进行详细说明。The page processing method, device, electronic device and storage medium of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

需要说明的是,本申请实施的页面处理方法被配置于页面处理装置(以下简称为处理装置)中来举例说明,处理装置可以应用于终端设备等电子设备中,以提高对html页面的加载的速度。It should be noted that the page processing method implemented in the present application is configured in a page processing device (hereinafter referred to as the processing device) for illustration, and the processing device can be applied to electronic devices such as terminal devices to increase the speed of loading HTML pages.

图1为本申请实施例提供的一种页面处理方法的流程示意图。FIG1 is a flow chart of a page processing method provided in an embodiment of the present application.

如图1所示,该方法包括:As shown in FIG1 , the method includes:

步骤101,响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表。Step 101, in response to the start of an application, obtain a first page address list of preloaded pages corresponding to the application.

其中,第一页面地址可以为统一资源定位系统(uniform resource locator,缩写URL)等,本申请对此不作限制。The first page address may be a uniform resource locator (URL) or the like, and this application does not impose any limitation on this.

本申请中,当监测到某一应用程序(Application,APP)启动时,可以向应用程序对应的服务端发送获取预加载页面信息的请求。服务端在接收到该请求后,可以将该应用程序对应的需要预加载的页面的第一页面地址列表发送给处理装置。由此,处理装置即可获取应用程序对应的预加载页面的第一页面地址列表。In this application, when a certain application (Application, APP) is detected to be started, a request for obtaining preloaded page information can be sent to the server corresponding to the application. After receiving the request, the server can send the first page address list of the pages that need to be preloaded corresponding to the application to the processing device. In this way, the processing device can obtain the first page address list of the preloaded pages corresponding to the application.

步骤102,基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源。Step 102, preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address.

本申请中,基于第一页面地址列表中各第一页面地址进行页面资源预加载的过程包括过程:获取第一页面地址对应的第一页面代码文件,获取第一页面代码文件中原资源地址对应的资源,标识修改原资源地址生成第一资源地址的过程。In the present application, the process of preloading page resources based on each first page address in the first page address list includes the process of: obtaining the first page code file corresponding to the first page address, obtaining the resource corresponding to the original resource address in the first page code file, and identifying the process of modifying the original resource address to generate the first resource address.

获取第一页面地址对应的第一页面代码文件的过程如下:确定本地存储中是否存在与第一页面地址关联存储的第一响应数据。在本地存储中不存在与第一页面地址关联存储的第一响应数据的情况下,说明未针对第一页面地址进行预加载。因此,可以基于预设加载页面的方式,向服务端发送第一页面地址对应的第一页面代码文件的页面获取请求。服务端在接收到该页面获取请求后,可以向处理装置发送反馈消息,反馈消息中包含第一页面地址对应的第一页面代码文件及校验标识(etag)。由此,处理装置即可获取并关联保存第一页面地址对应的第一页面代码文件,并基于etag生成并保存第一页面地址关联的第一响应数据。The process of obtaining the first page code file corresponding to the first page address is as follows: determine whether there is first response data stored in association with the first page address in the local storage. If there is no first response data stored in association with the first page address in the local storage, it means that the first page address has not been preloaded. Therefore, based on the preset loading page method, a page acquisition request for the first page code file corresponding to the first page address can be sent to the server. After receiving the page acquisition request, the server can send a feedback message to the processing device, and the feedback message includes the first page code file corresponding to the first page address and a verification identifier (etag). Thus, the processing device can obtain and associate the first page code file corresponding to the first page address, and generate and save the first response data associated with the first page address based on the etag.

在本地存储中存在与第一页面地址关联存储的第一响应数据的情况下,说明已针对第一页面地址进行预加载,因此,本地存储中已存储第一页面地址对应的第一页面代码文件。之后,可以直接从本地存储中直接获取第一页面地址对应的第一页面代码文件。If the first response data associated with the first page address is stored in the local storage, it means that the first page address has been preloaded, so the first page code file corresponding to the first page address has been stored in the local storage. Afterwards, the first page code file corresponding to the first page address can be directly obtained from the local storage.

标识修改原资源地址生成第一资源地址的过程如下:在获取第一页面代码文件后,可以对第一页面代码文件进行解析,确定第一页面代码文件中包含的原资源地址。比如,可以利用预设的正则表达式从第一页面代码文件中提取原资源地址。可以理解的是原资源地址可以为一个或多个。The process of identifying and modifying the original resource address to generate the first resource address is as follows: after obtaining the first page code file, the first page code file can be parsed to determine the original resource address contained in the first page code file. For example, the original resource address can be extracted from the first page code file using a preset regular expression. It is understandable that the original resource address can be one or more.

之后,在原资源地址中按照预设规则加入标识字段,生成原资源地址对应的第一资源地址。其中,标识字段用于标识本地存储中已存储第一资源地址对应的原资源地址的资源。Afterwards, an identification field is added to the original resource address according to a preset rule to generate a first resource address corresponding to the original resource address, wherein the identification field is used to identify the resource in the local storage that has stored the original resource address corresponding to the first resource address.

获取第一页面代码文件中原资源地址对应的资源的过程如下:基于原资源地址向服务端发送资源获取请求,请求获取各原资源地址对应的资源。The process of obtaining the resources corresponding to the original resource addresses in the first page code file is as follows: a resource acquisition request is sent to the server based on the original resource addresses, requesting to obtain the resources corresponding to each original resource address.

本申请中,可以将原资源地址对应的第一资源地址、资源关联存储在系统中。并在完成对第一页面地址对应的页面预加载之后,即可释放预加载占用的内存,避免内存资源的占用。In this application, the first resource address and resource association corresponding to the original resource address can be stored in the system. After completing the preloading of the page corresponding to the first page address, the memory occupied by the preloading can be released to avoid the occupation of memory resources.

可以理解的是,同一产品线下应用程序的页面,图片等资源相同,对第一页面代码文件中的原资源地址进行改造后,将第一资源地址与其对应的资源关联存储在本地存储中,实现来了对多个应用程序的页面资源的统一管理,有利于实现对资源的复用。It can be understood that the pages, pictures and other resources of the applications under the same product line are the same. After the original resource address in the first page code file is modified, the first resource address is associated with its corresponding resource and stored in the local storage, thereby realizing unified management of page resources of multiple applications, which is conducive to the reuse of resources.

步骤103,针对获取的待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中的原资源地址标识修改后的第二资源地址。Step 103, for the second page address of the page to be displayed, when the second response data corresponding to the second page address is matched from the locally stored first response data, the second response data is verified to obtain the second page code file corresponding to the second page address based on the verification result, and the second resource address after the original resource address identifier in the second page code file is modified.

本申请中,第二页面地址可以和第一页面地址相同也可以不同。待展示页面可以为应用程序启动时的首页页面,或者可以为在应用程序进行页面切换时待切换的页面。本申请对此不作限制。In the present application, the second page address may be the same as or different from the first page address. The page to be displayed may be the home page when the application is started, or may be the page to be switched when the application switches pages. The present application does not limit this.

本申请中,可以将第二页面地址与各第一响应数据关联的第一页面地址匹配。当任一第一响应数据关联的第一页面地址与第二页面地址相同时,可以将该第一响应数据确定为第二页面地址关联的第二响应数据。In the present application, the second page address can be matched with the first page address associated with each first response data. When the first page address associated with any first response data is the same as the second page address, the first response data can be determined as the second response data associated with the second page address.

在确定出第二响应数据的情况下,说明已经完成对第二页面地址对应的页面的预加载。但是,考虑到第二页面地址对应的第二页面代码文件可能发生更新。因此,为了保证页面处理的准确性,可以对第二响应数据进行校验,以确定第二页面代码文件是否更新。从而根据第二页面代码文件的更新情况,从本地存储中或者服务端获取第二页面代码文件。When the second response data is determined, it means that the preloading of the page corresponding to the second page address has been completed. However, considering that the second page code file corresponding to the second page address may be updated. Therefore, in order to ensure the accuracy of page processing, the second response data can be verified to determine whether the second page code file is updated. Therefore, according to the update status of the second page code file, the second page code file is obtained from the local storage or the server.

其中,对第二响应数据进行校验,以确定第二页面代码文件是否更新的过程如下:可以将第二响应数据拼接到新的请求头中,并基于该请求头及第二页面地址向服务端发送询问请求。服务端在接收到询问请求后,即可基于询问请求中的第二响应数据确定第二页面代码文件是否更新。当服务端确定第二页面代码文件未更新,则向处理装置返回指示码“304”,无需返回第二页面代码文件。由此,处理装置在确定服务端返回“304”时,即可确定第二页面代码文件未更新,此时即可从本地存储中获取第二页面地址对应的第二页面代码文件。当服务端确定第二页面代码文件更新,则向处理装置返回指示码“200”,并返回新的第二页面代码文件。由此,处理装置在确定服务端返回“200”时,即可确定第二页面代码文件更新,并将从服务端接收的新的第二页面代码文件确定为第二页面地址对应的第二页面代码文件。The process of verifying the second response data to determine whether the second page code file is updated is as follows: the second response data can be spliced into a new request header, and a query request can be sent to the server based on the request header and the second page address. After receiving the query request, the server can determine whether the second page code file is updated based on the second response data in the query request. When the server determines that the second page code file is not updated, it returns an indication code "304" to the processing device without returning the second page code file. Therefore, when the processing device determines that the server returns "304", it can determine that the second page code file is not updated, and at this time, the second page code file corresponding to the second page address can be obtained from the local storage. When the server determines that the second page code file is updated, it returns an indication code "200" to the processing device and returns a new second page code file. Therefore, when the processing device determines that the server returns "200", it can determine that the second page code file is updated, and determine the new second page code file received from the server as the second page code file corresponding to the second page address.

之后,再对第二页面代码文件进行解析确定第二页面代码文件中原资源地址,并利用预设规则在该原资源地址中加入标识字段,生成该原资源地址对应的第二资源地址。或者,当从本地存储中获取第二页面代码文件时,说明已经对第二页面代码文件进行预加载处理,因此可以从本地存储中获取该第二页面代码文件关联存储的第二资源地址。其中,用于生成第二资源地址的预设规则与生成第一资源地址的预设规则相同。After that, the second page code file is parsed to determine the original resource address in the second page code file, and an identification field is added to the original resource address using a preset rule to generate a second resource address corresponding to the original resource address. Alternatively, when the second page code file is obtained from the local storage, it means that the second page code file has been preloaded, so the second resource address associated with the second page code file can be obtained from the local storage. The preset rule for generating the second resource address is the same as the preset rule for generating the first resource address.

步骤104,在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源。Step 104 , when the identifier corresponding to the second resource address is a preset identifier, match the resource corresponding to the second resource address from the resources corresponding to the first resource addresses stored locally.

本申请中,可以将第二资源地址中预设位置的字符确定为第二资源地址对应的标识,在第二资源地址对应的标识为预设标识的情况下,说明本地存储中已预加载第二资源地址对应的资源。因此,可以将第二资源地址与各第一资源地址进行匹配,当某一第一资源地址与第二资源地址相同时,可以确定该第一资源地址关联存储的资源为第二资源地址对应的资源。In the present application, the character at the preset position in the second resource address can be determined as the identifier corresponding to the second resource address. When the identifier corresponding to the second resource address is the preset identifier, it means that the resource corresponding to the second resource address has been preloaded in the local storage. Therefore, the second resource address can be matched with each first resource address. When a first resource address is the same as the second resource address, it can be determined that the resource stored in association with the first resource address is the resource corresponding to the second resource address.

可选的,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据失败的情况下,说明未对第二页面地址对应的页面进行页面资源预加载操作。因此,可以向应用程序对应的服务端发送页面获取请求,以获取第二页面地址对应的第二页面代码文件,并直接将第二页面代码文件中包含的原资源地址确定为第二资源地址。可以理解的是该第二资源地址对应的标识不为预设标识。Optionally, in the case where the second response data corresponding to the second page address fails to be matched from each first response data stored locally, it indicates that the page resource preloading operation is not performed on the page corresponding to the second page address. Therefore, a page acquisition request can be sent to the server corresponding to the application to obtain the second page code file corresponding to the second page address, and the original resource address contained in the second page code file is directly determined as the second resource address. It can be understood that the identifier corresponding to the second resource address is not a preset identifier.

可选的,在第二资源地址对应的标识不为预设标识的情况下,说明本地存储中未预加载第二资源地址对应的资源。因此,可以向应用程序对应的服务端发送针对该第二资源地址的资源获取请求,服务端在接收到该资源获取请求后,向处理装置发送第二资源地址对应的资源。Optionally, when the identifier corresponding to the second resource address is not a preset identifier, it means that the resource corresponding to the second resource address is not preloaded in the local storage. Therefore, a resource acquisition request for the second resource address can be sent to the server corresponding to the application, and after receiving the resource acquisition request, the server sends the resource corresponding to the second resource address to the processing device.

步骤105,基于第二资源地址对应的资源进行待展示页面的渲染。Step 105: Render the page to be displayed based on the resource corresponding to the second resource address.

本申请中,在获取第二资源地址对应的资源后,即可利用预设的任意渲染方法,基于第二资源地址对应的资源进行待展示页面的渲染。In the present application, after obtaining the resource corresponding to the second resource address, any preset rendering method can be used to render the page to be displayed based on the resource corresponding to the second resource address.

本申请中,处理装置可以起两个线程,辅线程用于执行步骤101-步骤102的页面预加载的过程,主线程用于执行步骤103-步骤105的页面展示的过程。In the present application, the processing device may start two threads, the auxiliary thread is used to execute the page preloading process of step 101-step 102, and the main thread is used to execute the page display process of step 103-step 105.

此外,页面预加载过程和页面展示的过程可以同步进行也可以异步进行。并且可以为辅线程设置低于主线程的优先级,从而时页面预加载的过程不抢占应用程序主要业务的资源。In addition, the page preloading process and the page display process can be performed synchronously or asynchronously. And the auxiliary thread can be set with a lower priority than the main thread, so that the page preloading process does not occupy the resources of the main business of the application.

本申请中,响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表,并基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源,之后,针对获取的待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中的原资源地址标识修改后的第二资源地址,并在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源,然后,基于第二资源地址对应的资源进行待展示页面的渲染。由此,通过在本地存储中保存预加载页面对应的相关资源,并在本地存储了待展示页面对应的资源的情况下,对待展示页面对应的原资源地址进行标识修改,获取包含预设标识的第二资源地址,以便于基于第二资源地址中是否包含预设标识,实现对向服务端发送获取相关资源请求的拦截,并直接从本地存储中获取资源。从而提高了页面处理的效率。In the present application, in response to the start of an application, a first page address list of preloaded pages corresponding to the application is obtained, and page resources are preloaded based on each first page address in the first page address list, and the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address are obtained and locally saved. Then, for the second page address of the obtained page to be displayed, when the second response data corresponding to the second page address is matched from each first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address based on the verification result, and the second resource address after the original resource address identifier in the second page code file is modified, and when the identifier corresponding to the second resource address is a preset identifier, the resource corresponding to the second resource address is matched from the resources corresponding to each first resource address stored locally, and then, the page to be displayed is rendered based on the resource corresponding to the second resource address. Therefore, by saving the relevant resources corresponding to the preloaded page in the local storage, and when the resources corresponding to the page to be displayed are stored locally, the original resource address corresponding to the page to be displayed is modified, and the second resource address containing the preset identifier is obtained, so as to intercept the request for obtaining the relevant resources sent to the server based on whether the second resource address contains the preset identifier, and directly obtain the resources from the local storage. This improves the efficiency of page processing.

图2为本申请实施例提供的一种页面处理方法的流程示意图。FIG. 2 is a flow chart of a page processing method provided in an embodiment of the present application.

如图2所示,该方法包括:As shown in FIG. 2 , the method includes:

步骤201,响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表。Step 201, in response to the start of an application, obtain a first page address list of preloaded pages corresponding to the application.

本申请中,步骤201的具体实现过程,可参见本公开任一实施例的详细描述,在此不再赘述。In the present application, the specific implementation process of step 201 can be found in the detailed description of any embodiment of the present disclosure, and will not be repeated here.

步骤202,基于第一页面地址列表中各第一页面地址进行页面预处理,以获取每个第一页面地址对应的第一页面代码文件及第一响应数据,及各第一页面代码文件中原资源地址标识修改后的第一资源地址。Step 202 , performing page preprocessing based on each first page address in the first page address list to obtain a first page code file and first response data corresponding to each first page address, and a first resource address after the original resource address identifier in each first page code file is modified.

其中,第一响应数据的具体解释,可参见本公开任一实施例的详细描述,在此不再赘述。Among them, the specific explanation of the first response data can be found in the detailed description of any embodiment of the present disclosure, and will not be repeated here.

本申请中,可以确定本地存储中是否存在与第一页面地址关联存储的第一响应数据。在本地存储中存在第一页面地址对应的第一响应数据的情况下,说明已经本地存储中已经存储了第一页面地址对应的第一页面代码文件。但是,由于第一页面代码文件可能已经更新,为了保证预加载页面的准确性,可以将第一响应数据拼接到新的请求头中,并基于该请求头及第一页面地址向服务端发送询问请求。服务端在接收到询问请求后,即可基于询问请求中的第一响应数据确定第一页面代码文件是否更新。当服务端确定第一页面代码文件未更新,则向处理装置返回指示码“304”,无需返回第一页面代码文件。由此,处理装置在确定服务端返回指示码“304”时,即可确定第一页面代码文件未更新,此时即可从本地存储中获取第一页面地址对应的第一页面代码文件。In the present application, it can be determined whether there is first response data stored in association with the first page address in the local storage. In the case where there is first response data corresponding to the first page address in the local storage, it means that the first page code file corresponding to the first page address has been stored in the local storage. However, since the first page code file may have been updated, in order to ensure the accuracy of the preloaded page, the first response data can be spliced into a new request header, and a query request can be sent to the server based on the request header and the first page address. After receiving the query request, the server can determine whether the first page code file is updated based on the first response data in the query request. When the server determines that the first page code file has not been updated, it returns an indication code "304" to the processing device without returning the first page code file. Therefore, when the processing device determines that the server returns the indication code "304", it can determine that the first page code file has not been updated, and at this time, the first page code file corresponding to the first page address can be obtained from the local storage.

当服务端确定第一页面代码文件发生更新,则向处理装置反馈第一页面地址对应的新的第一页面代码文件及新的校验标识(etag)。由此,处理装置即可获取第一页面地址对应的新的第一页面代码文件,并利用新的第一页面代码文件更新本地存储中对应的第一页面代码文件,利用新的etag更新第一页面地址关联的第一响应数据。从而保证对本地缓存的预加载页面对应的资源的及时更新。When the server determines that the first page code file is updated, it feeds back the new first page code file and the new verification tag (etag) corresponding to the first page address to the processing device. Thus, the processing device can obtain the new first page code file corresponding to the first page address, and use the new first page code file to update the corresponding first page code file in the local storage, and use the new etag to update the first response data associated with the first page address. This ensures that the resources corresponding to the preloaded page in the local cache are updated in a timely manner.

此外,在获取新的第一页面代码文件后,可以对第一页面代码文件进行解析,确定第一页面代码文件中包含的原资源地址。之后,可以利用预设标识替换原资源地址中协议类型(scheme)对应的字符,生成原资源地址对应的第一资源地址。In addition, after obtaining the new first page code file, the first page code file can be parsed to determine the original resource address contained in the first page code file. Afterwards, the characters corresponding to the protocol type (scheme) in the original resource address can be replaced with a preset identifier to generate a first resource address corresponding to the original resource address.

可选的,可以将不同类型资源对应的原资源地址中协议类型(scheme)对应的字符更新为不同的预设标识。比如,视频等媒体文件资源对应的原资源地址中scheme部分替换为“mediaFile://”,将代码文件资源对应的原资源地址中scheme部分替换为“codeFile://”。Optionally, the characters corresponding to the protocol type (scheme) in the original resource addresses corresponding to different types of resources can be updated to different preset identifiers. For example, the scheme part in the original resource address corresponding to media file resources such as video is replaced with "mediaFile://", and the scheme part in the original resource address corresponding to code file resources is replaced with "codeFile://".

步骤203,在本地存储中不存在任一第一资源地址对应的资源的情况下,基于任一第一资源地址对应的原资源地址,向应用程序对应的服务端发送资源获取请求。Step 203: When there is no resource corresponding to any of the first resource addresses in the local storage, a resource acquisition request is sent to a server corresponding to the application based on an original resource address corresponding to any of the first resource addresses.

本申请中,可以查询确定本地存储中是否存储第一资源地址对应的资源。在本地存储中不存在某一第一资源地址对应的资源的情况下,可以基于该第一资源地址对应的原资源地址,向服务端发送资源获取请求,请求获取第一资源地址对应的资源。从而避免重复下载资源,提高页面处理的效率。In this application, it is possible to query and determine whether the resource corresponding to the first resource address is stored in the local storage. If the resource corresponding to a first resource address does not exist in the local storage, a resource acquisition request can be sent to the server based on the original resource address corresponding to the first resource address to request the resource corresponding to the first resource address. This avoids repeated downloading of resources and improves the efficiency of page processing.

步骤204,接收服务端发送的任一第一资源地址对应的资源。Step 204: Receive a resource corresponding to any first resource address sent by the server.

步骤205,将各第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源,关联存储在本地存储中。Step 205 , the first page code files and first response data corresponding to each first page address, the first resource addresses after the original resource address identifiers in each first page code file are modified, and the resources corresponding to each first resource address are associated and stored in the local storage.

步骤206,针对获取的应用程序待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中原资源地址标识修改后的第二资源地址。Step 206, with respect to the second page address of the application page to be displayed, when the second response data corresponding to the second page address is matched from each first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address based on the verification result, and the second resource address after the original resource address identifier in the second page code file is modified.

步骤207,在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源。Step 207: When the identifier corresponding to the second resource address is a preset identifier, a resource corresponding to the second resource address is matched from the resources corresponding to the first resource addresses stored locally.

步骤208,基于第二资源地址对应的资源进行待展示页面的渲染。Step 208: Render the page to be displayed based on the resource corresponding to the second resource address.

本申请中,步骤206-步骤208的具体实现过程,可参见本公开任一实施例的详细描述,在此不再赘述。In the present application, the specific implementation process of step 206 to step 208 can be found in the detailed description of any embodiment of the present disclosure, and will not be repeated here.

本申请中,可以基于第一页面地址列表中各第一页面地址进行页面预处理,以获取每个第一页面地址对应的第一页面代码文件及第一响应数据,及各第一页面代码文件中原资源地址标识修改后的第一资源地址,之后,在本地存储中不存在任一第一资源地址对应的资源的情况下,基于任一第一资源地址对应的原资源地址,向应用程序对应的服务端发送资源获取请求,并接收服务端发送的任一第一资源地址对应的资源,然后,将各第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源,关联存储在本地存储中。从而避免重复下载资源,提高了页面处理的效率。In the present application, page preprocessing can be performed based on each first page address in the first page address list to obtain the first page code file and first response data corresponding to each first page address, and the first resource address after the original resource address identifier in each first page code file is modified. Afterwards, if there is no resource corresponding to any first resource address in the local storage, based on the original resource address corresponding to any first resource address, a resource acquisition request is sent to the server corresponding to the application, and the resource corresponding to any first resource address sent by the server is received. Then, the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resource corresponding to each first resource address are associated and stored in the local storage. This avoids repeated downloading of resources and improves the efficiency of page processing.

图3为本申请实施例提供的一种页面处理方法的流程示意图。FIG3 is a flow chart of a page processing method provided in an embodiment of the present application.

如图3所示,该方法包括:As shown in FIG3 , the method includes:

步骤301,响应与客户端启动,获取预加载的第一页面地址列表。Step 301, in response to the client startup, obtain a preloaded first page address list.

步骤302,基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源。Step 302, preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address.

步骤303,针对获取的应用程序待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中原资源地址标识修改后的第二资源地址。Step 303, with respect to the second page address of the page to be displayed of the application, when the second response data corresponding to the second page address is matched from each first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address based on the verification result, and the second resource address after the original resource address identifier in the second page code file is modified.

步骤304,在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源。Step 304: When the identifier corresponding to the second resource address is a preset identifier, a resource corresponding to the second resource address is matched from the resources corresponding to the first resource addresses stored locally.

本申请中,步骤301-步骤304的具体实现过程,可参见本公开任一实施例的详细描述,在此不再赘述。In the present application, the specific implementation process of steps 301 to 304 can be found in the detailed description of any embodiment of the present disclosure, and will not be repeated here.

步骤305,在从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源失败的情况下,查询下载列表确定第二资源地址对应的资源是否待下载或者正在下载。Step 305: when the resource corresponding to the second resource address fails to be matched from the resources corresponding to the first resource addresses stored locally, query the download list to determine whether the resource corresponding to the second resource address is to be downloaded or is being downloaded.

本申请中,在页面预加载的过程和页面展示的过程同步进行时,当待展示页面和预加载页面相同,并且预加载页面未完成的情况下,本地存储中可能还未存储第二资源地址对应的资源。In the present application, when the page preloading process and the page display process are performed simultaneously, when the page to be displayed is the same as the preloaded page and the preloaded page is not completed, the resource corresponding to the second resource address may not be stored in the local storage.

因此,在从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源失败的情况下,第二资源地址对应的资源可能待下载或者正在下载。可以获取下载列表,并基于第二资源地址对应的原资源地址,查询确定下载列表中等待下载的任务和正在下载的任务中是否为该第二资源地址对应的资源的下载任务。当下载列表中等待下载的任务和正在下载的任务中是否为第二资源地址对应的资源的下载任务时,即可确定第二资源地址对应的资源待下载或者正在下载。当下载列表中等待下载的任务和正在下载的任务中均不为第二资源地址对应的资源的下载任务时,可以生成下载资源异常提示。Therefore, in the event that the resource corresponding to the second resource address fails to be matched from the resources corresponding to the first resource addresses stored locally, the resource corresponding to the second resource address may be to be downloaded or being downloaded. A download list can be obtained, and based on the original resource address corresponding to the second resource address, a query can be made to determine whether the tasks waiting to be downloaded and the tasks being downloaded in the download list are download tasks for the resource corresponding to the second resource address. When the tasks waiting to be downloaded and the tasks being downloaded in the download list are download tasks for the resource corresponding to the second resource address, it can be determined that the resource corresponding to the second resource address is to be downloaded or being downloaded. When neither the tasks waiting to be downloaded nor the tasks being downloaded in the download list are download tasks for the resource corresponding to the second resource address, a download resource exception prompt can be generated.

步骤306,在第二资源地址对应的资源待下载或者正在下载的情况下,等待下载完毕后,获取第二资源地址对应的资源。Step 306: When the resource corresponding to the second resource address is to be downloaded or is being downloaded, after waiting for the download to be completed, obtain the resource corresponding to the second resource address.

本申请中,在第二资源地址对应的资源待下载或者正在下载的情况下,可以等待资源下载完毕后,再从本地存储中获取第二资源地址对应的资源。从而避免对资源的重复下载,提高页面处理的效率。In this application, when the resource corresponding to the second resource address is to be downloaded or is being downloaded, the resource corresponding to the second resource address can be obtained from the local storage after the resource download is completed, thereby avoiding repeated downloading of resources and improving the efficiency of page processing.

或者,以预设时间间隔多次执行从本地存储的各第一资源地址对应的资源中匹配出第二资源地址的过程,直至从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源。Alternatively, the process of matching the second resource address from the resources corresponding to the first resource addresses stored locally is performed multiple times at preset time intervals until the resource corresponding to the second resource address is matched from the resources corresponding to the first resource addresses stored locally.

或者,以预设时间间隔多次执行从本地存储的各第一资源地址对应的资源中匹配出第二资源地址的过程,直至执行上述匹配过程的次数等于预设阈值,停止执行上述匹配过程,并生成下载资源异常提示。Alternatively, the process of matching the second resource address from the resources corresponding to each first resource address stored locally is performed multiple times at preset time intervals until the number of executions of the above matching process equals a preset threshold, the above matching process is stopped, and a download resource abnormality prompt is generated.

步骤307,基于第而资源地址对应的资源进行待展示页面的渲染。Step 307: Render the page to be displayed based on the resource corresponding to the second resource address.

本申请中,步骤307的具体实现过程,可参见本公开任一实施例的详细描述,在此不再赘述。In the present application, the specific implementation process of step 307 can be found in the detailed description of any embodiment of the present disclosure, and will not be repeated here.

本申请中,在从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源失败的情况下,查询下载列表确定第二资源地址对应的资源是否待下载或者正在下载,并在第二资源地址对应的资源待下载或者正在下载的情况下,等待下载完毕后,获取第二资源地址对应的资源。从而避免对资源的重复下载,提高了页面处理的效率。In the present application, when the resource corresponding to the second resource address fails to be matched from the resources corresponding to the first resource addresses stored locally, the download list is queried to determine whether the resource corresponding to the second resource address is to be downloaded or is being downloaded, and when the resource corresponding to the second resource address is to be downloaded or is being downloaded, the resource corresponding to the second resource address is obtained after the download is completed. This avoids repeated downloading of resources and improves the efficiency of page processing.

图4为本申请实施例提供的一种页面处理装置的结构示意图。FIG. 4 is a schematic diagram of the structure of a page processing device provided in an embodiment of the present application.

如图4所示,该页面处理装置400包括:获取模块410、预加载模块420、校验模块430、确定模块440、渲染模块450。As shown in FIG. 4 , the page processing device 400 includes: an acquisition module 410 , a preloading module 420 , a verification module 430 , a determination module 440 , and a rendering module 450 .

获取模块410,用于响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表;An acquisition module 410 is used to respond to the application startup and acquire a first page address list of preloaded pages corresponding to the application;

预加载模块420,用于基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源;A preloading module 420 is used to preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address;

校验模块430,用于针对获取的应用程序待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中原资源地址标识修改后的第二资源地址;The verification module 430 is used to verify the second response data for the second page address of the page to be displayed of the application program obtained, when the second response data corresponding to the second page address is matched from each first response data stored locally, so as to obtain the second page code file corresponding to the second page address and the second resource address after the original resource address identifier in the second page code file is modified based on the verification result;

确定模块440,用于在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源;A determination module 440 is used to match the resource corresponding to the second resource address from the resources corresponding to the first resource addresses stored locally when the identifier corresponding to the second resource address is a preset identifier;

渲染模块450,用于基于第二资源地址对应的资源进行待展示页面的渲染。The rendering module 450 is used to render the page to be displayed based on the resource corresponding to the second resource address.

在本申请实施例一种可能的实现方式中,预加载模块420,用于:In a possible implementation of the embodiment of the present application, the preloading module 420 is used to:

基于第一页面地址列表中各第一页面地址进行页面预处理,以获取每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址;Perform page preprocessing based on each first page address in the first page address list to obtain a first page code file and first response data corresponding to each first page address, and a first resource address after the original resource address identifier in each first page code file is modified;

在本地存储中不存在任一第一资源地址对应的资源的情况下,基于任一第一资源地址对应的原资源地址,向应用程序对应的服务端发送资源获取请求;When there is no resource corresponding to any of the first resource addresses in the local storage, sending a resource acquisition request to the server corresponding to the application based on the original resource address corresponding to any of the first resource addresses;

接收服务端发送的任一第一资源地址对应的资源;Receive a resource corresponding to any first resource address sent by the server;

将各第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源,关联存储在本地存储中。The first page code files and first response data corresponding to each first page address, the first resource addresses after the original resource address identifiers in each first page code file are modified, and the resources corresponding to each first resource address are associated and stored in the local storage.

在本申请实施例一种可能的实现方式中,预加载模块420,用于:In a possible implementation of the embodiment of the present application, the preloading module 420 is used to:

在本地存储中存在第一页面地址对应的第一响应数据的情况下,基于第一响应数据及第一页面地址向服务端发送询问请求,以确定第一页面地址对应的第一页面代码文件是否更新;In the case where the first response data corresponding to the first page address exists in the local storage, sending a query request to the server based on the first response data and the first page address to determine whether the first page code file corresponding to the first page address is updated;

在第一页面地址对应的第一页面代码文件更新的情况下,获取服务端发送的第一页面地址对应的更新后的第一页面代码文件,及更新后的第一页面代码文件中包含的更新后的原资源地址;When the first page code file corresponding to the first page address is updated, obtaining the updated first page code file corresponding to the first page address sent by the server, and the updated original resource address contained in the updated first page code file;

利用预设标识替换原资源地址中协议类型对应的字符,生成原资源地址对应的第一资源地址。The characters corresponding to the protocol type in the original resource address are replaced with a preset identifier to generate a first resource address corresponding to the original resource address.

在本申请实施例一种可能的实现方式中,预加载模块420,用于:In a possible implementation of the embodiment of the present application, the preloading module 420 is used to:

在本地存储中不存在第一页面地址对应的第一响应数据的情况下,向服务端发送页面获取请求,以获取第一页面地址对应的第一响应数据、第一页面地址对应的第一页面代码文件,及第一页面代码文件中包含的原资源地址。When the first response data corresponding to the first page address does not exist in the local storage, a page acquisition request is sent to the server to obtain the first response data corresponding to the first page address, the first page code file corresponding to the first page address, and the original resource address contained in the first page code file.

在本申请实施例一种可能的实现方式中,确定模块440,用于:In a possible implementation of the embodiment of the present application, the determination module 440 is used to:

在从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源失败的情况下,查询下载列表确定第二资源地址对应的资源是否待下载或者正在下载;In the case where the resource corresponding to the second resource address fails to be matched from the resources corresponding to the first resource addresses stored locally, querying the download list to determine whether the resource corresponding to the second resource address is to be downloaded or is being downloaded;

在第二资源地址对应的资源待下载或者正在下载的情况下,等待下载完毕后,获取第二资源地址对应的资源。When the resource corresponding to the second resource address is to be downloaded or is being downloaded, the resource corresponding to the second resource address is acquired after the download is completed.

在本申请实施例一种可能的实现方式中,预加载模块420,还用于:In a possible implementation of the embodiment of the present application, the preloading module 420 is further used to:

在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据失败的情况下,向应用程序对应的服务端发送页面获取请求,以获取第二页面地址对应的第二页面代码文件;In the case where the second response data corresponding to the second page address cannot be matched from the locally stored first response data, a page acquisition request is sent to the server corresponding to the application to acquire the second page code file corresponding to the second page address;

将第二页面代码文件中包含的原资源地址确定为第二资源地址。The original resource address included in the second page code file is determined as the second resource address.

在本申请实施例一种可能的实现方式中,还包括:In a possible implementation of the embodiment of the present application, it also includes:

收发模块,用于在第二资源地址对应的标识不为预设标识的情况下,向应用程序对应的服务端发送资源获取请求,以获取第二资源地址对应的资源。The transceiver module is used to send a resource acquisition request to the server corresponding to the application program when the identifier corresponding to the second resource address is not a preset identifier, so as to acquire the resource corresponding to the second resource address.

需要说明的是,前述页面处理方法实施例的解释说明,也适用于该实施例的装置,故在此不再赘述。It should be noted that the explanation of the aforementioned page processing method embodiment is also applicable to the device of this embodiment, so it will not be repeated here.

本申请中,响应与应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表,并基于第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个第一页面地址对应的第一页面代码文件及第一响应数据、各第一页面代码文件中原资源地址标识修改后的第一资源地址、各第一资源地址对应的资源,之后,针对获取的待展示页面的第二页面地址,在从本地存储的各第一响应数据中匹配出第二页面地址对应的第二响应数据的情况下,对第二响应数据进行校验,以基于校验结果获取第二页面地址对应的第二页面代码文件,及第二页面代码文件中的原资源地址标识修改后的第二资源地址,并在第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出第二资源地址对应的资源,然后,基于第二资源地址对应的资源进行待展示页面的渲染。由此,通过在本地存储中保存预加载页面对应的相关资源,并在本地存储了待展示页面对应的资源的情况下,对待展示页面对应的原资源地址进行标识修改,获取包含预设标识的第二资源地址,以便于基于第二资源地址中是否包含预设标识,实现对向服务端发送获取相关资源请求的拦截,并直接从本地存储中获取资源。从而提高了页面处理的效率。In the present application, in response to the start of an application, a first page address list of preloaded pages corresponding to the application is obtained, and page resources are preloaded based on each first page address in the first page address list, and the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resources corresponding to each first resource address are obtained and locally saved. Then, for the second page address of the obtained page to be displayed, when the second response data corresponding to the second page address is matched from each first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address based on the verification result, and the second resource address after the original resource address identifier in the second page code file is modified, and when the identifier corresponding to the second resource address is a preset identifier, the resource corresponding to the second resource address is matched from the resources corresponding to each first resource address stored locally, and then, the page to be displayed is rendered based on the resource corresponding to the second resource address. Therefore, by saving the relevant resources corresponding to the preloaded page in the local storage, and when the resources corresponding to the page to be displayed are stored locally, the original resource address corresponding to the page to be displayed is modified, and the second resource address containing the preset identifier is obtained, so as to intercept the request for obtaining the relevant resources sent to the server based on whether the second resource address contains the preset identifier, and directly obtain the resources from the local storage. This improves the efficiency of page processing.

根据本申请的实施例,本申请还提供了一种电子设备、一种可读存储介质。According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

图5为本申请实施例提供的一种电子设备的结构示意图。如图5所示,该电子设备可以包括:FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in FIG5 , the electronic device may include:

存储有可执行程序代码的存储器501;A memory 501 storing executable program codes;

与存储器501耦合的处理器502;a processor 502 coupled to the memory 501;

其中,处理器502调用存储器501中存储的可执行程序代码,执行本申请任意实施例所提供的页面处理方法。The processor 502 calls the executable program code stored in the memory 501 to execute the page processing method provided in any embodiment of the present application.

该计算机设备实施例与上述方法实施例是基于同一发明构思得到的实施例,相关之处可以相互参照。上述计算机设备实施例与方法实施例相对应,与该方法实施例具有同样的技术效果,具体说明参见方法实施例。The computer device embodiment and the above method embodiment are embodiments based on the same inventive concept, and the relevant parts can be referenced to each other. The above computer device embodiment corresponds to the method embodiment and has the same technical effect as the method embodiment. For specific description, please refer to the method embodiment.

本申请实施例公开一种计算机可读存储介质,其存储计算机程序,其中,该计算机程序使得计算机执行本申请任意实施例所提供的页面处理方法。An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute a page processing method provided by any embodiment of the present application.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims (7)

Translated fromChinese
1.一种页面处理方法,其特征在于,包括:1. A page processing method, comprising:响应于应用程序启动,获取所述应用程序对应的预加载页面的第一页面地址列表;In response to the application being started, obtaining a first page address list of preloaded pages corresponding to the application;基于所述第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址、各所述第一资源地址对应的资源;Preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier is modified in each first page code file, and the resource corresponding to each first resource address;针对获取的所述应用程序待展示页面的第二页面地址,在从本地存储的各所述第一响应数据中匹配出所述第二页面地址对应的第二响应数据的情况下,对所述第二响应数据进行校验,以基于校验结果获取所述第二页面地址对应的第二页面代码文件,及所述第二页面代码文件中原资源地址标识修改后的第二资源地址;For the obtained second page address of the page to be displayed by the application, when the second response data corresponding to the second page address is matched from each of the first response data stored locally, the second response data is verified to obtain the second page code file corresponding to the second page address and the second resource address after the original resource address identifier in the second page code file is modified based on the verification result;在所述第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出所述第二资源地址对应的资源;In a case where the identifier corresponding to the second resource address is a preset identifier, matching the resource corresponding to the second resource address from the resources corresponding to the first resource addresses stored locally;在所述第二资源地址对应的标识不为预设标识的情况下,向所述应用程序对应的服务端发送资源获取请求,以获取所述第二资源地址对应的资源;When the identifier corresponding to the second resource address is not a preset identifier, sending a resource acquisition request to the server corresponding to the application to acquire the resource corresponding to the second resource address;基于所述第二资源地址对应的资源进行所述待展示页面的渲染;Rendering the page to be displayed based on the resource corresponding to the second resource address;其中,所述基于所述第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址、各所述第一资源地址对应的资源,包括:基于所述第一页面地址列表中各第一页面地址进行页面预处理,以获取每个所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址;在本地存储中不存在任一第一资源地址对应的资源的情况下,基于所述任一第一资源地址对应的原资源地址,向所述应用程序对应的服务端发送资源获取请求;接收所述服务端发送的所述任一第一资源地址对应的资源;将各所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址、各所述第一资源地址对应的资源,关联存储在本地存储中;Among them, the page resource preloading is performed based on each first page address in the first page address list, and the first page code file and the first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file is modified, and the resource corresponding to each first resource address are obtained and locally saved, including: page preprocessing is performed based on each first page address in the first page address list to obtain the first page code file and the first response data corresponding to each first page address, and the first resource address after the original resource address identifier in each first page code file is modified; in the case that the resource corresponding to any first resource address does not exist in the local storage, based on the original resource address corresponding to any first resource address, a resource acquisition request is sent to the server corresponding to the application; the resource corresponding to any first resource address sent by the server is received; the first page code file and the first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file, and the resource corresponding to each first resource address are stored in association in the local storage;所述基于所述第一页面地址列表中各第一页面地址进行页面预处理,包括:在本地存储中存在所述第一页面地址对应的第一响应数据的情况下,基于所述第一响应数据及所述第一页面地址向所述服务端发送询问请求,以确定所述第一页面地址对应的第一页面代码文件是否更新;在所述第一页面地址对应的第一页面代码文件更新的情况下,获取所述服务端发送的所述第一页面地址对应的更新后的第一页面代码文件,及更新后的第一页面代码文件中包含的更新后的原资源地址;利用所述预设标识替换所述原资源地址中协议类型对应的字符,生成所述原资源地址对应的第一资源地址。The page preprocessing based on each first page address in the first page address list includes: when there is first response data corresponding to the first page address in the local storage, sending an inquiry request to the server based on the first response data and the first page address to determine whether the first page code file corresponding to the first page address is updated; when the first page code file corresponding to the first page address is updated, obtaining the updated first page code file corresponding to the first page address sent by the server, and the updated original resource address contained in the updated first page code file; using the preset identifier to replace the characters corresponding to the protocol type in the original resource address to generate the first resource address corresponding to the original resource address.2.如权利要求1所述的方法,其特征在于,还包括:2. The method according to claim 1, further comprising:在本地存储中不存在所述第一页面地址对应的第一响应数据的情况下,向所述服务端发送页面获取请求,以获取所述第一页面地址对应的第一响应数据、所述第一页面地址对应的第一页面代码文件,及所述第一页面代码文件中包含的原资源地址。When the first response data corresponding to the first page address does not exist in the local storage, a page acquisition request is sent to the server to obtain the first response data corresponding to the first page address, the first page code file corresponding to the first page address, and the original resource address contained in the first page code file.3.如权利要求1所述的方法,其特征在于,在所述基于所述第二资源地址对应的资源进行所述待展示页面的渲染之前,还包括:3. The method according to claim 1, characterized in that before rendering the page to be displayed based on the resource corresponding to the second resource address, it also includes:在从本地存储的各第一资源地址对应的资源中匹配出所述第二资源地址对应的资源失败的情况下,查询下载列表确定所述第二资源地址对应的资源是否待下载或者正在下载;In the case where the resource corresponding to the second resource address fails to be matched from the resources corresponding to the first resource addresses stored locally, querying the download list to determine whether the resource corresponding to the second resource address is to be downloaded or is being downloaded;在所述第二资源地址对应的资源待下载或者正在下载的情况下,等待下载完毕后,获取所述第二资源地址对应的资源。When the resource corresponding to the second resource address is to be downloaded or is being downloaded, the resource corresponding to the second resource address is obtained after the download is completed.4.如权利要求1所述的方法,其特征在于,在所述基于所述第二资源地址对应的资源进行所述待展示页面的渲染之前,还包括:4. The method according to claim 1, characterized in that before rendering the page to be displayed based on the resource corresponding to the second resource address, it also includes:在从本地存储的各所述第一响应数据中匹配出所述第二页面地址对应的第二响应数据失败的情况下,向所述应用程序对应的服务端发送页面获取请求,以获取所述第二页面地址对应的第二页面代码文件;In the case where the second response data corresponding to the second page address cannot be matched from the locally stored first response data, sending a page acquisition request to the server corresponding to the application to acquire the second page code file corresponding to the second page address;将所述第二页面代码文件中包含的原资源地址确定为第二资源地址。The original resource address included in the second page code file is determined as the second resource address.5.一种页面处理装置,其特征在于,包括:5. A page processing device, comprising:获取模块,用于响应于应用程序启动,获取应用程序对应的预加载页面的第一页面地址列表;An acquisition module, configured to acquire, in response to the application being started, a first page address list of preloaded pages corresponding to the application;预加载模块,用于基于所述第一页面地址列表中各第一页面地址进行页面资源预加载,获取并本地保存每个所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址、各所述第一资源地址对应的资源;A preloading module is used to preload page resources based on each first page address in the first page address list, obtain and locally save the first page code file and first response data corresponding to each first page address, the first resource address after the original resource address identifier is modified in each first page code file, and the resources corresponding to each first resource address;校验模块,用于针对获取的所述应用程序待展示页面的第二页面地址,在从本地存储的各所述第一响应数据中匹配出所述第二页面地址对应的第二响应数据的情况下,对所述第二响应数据进行校验,以基于校验结果获取所述第二页面地址对应的第二页面代码文件,及所述第二页面代码文件中原资源地址标识修改后的第二资源地址;a verification module, for verifying the second response data, when matching the second response data corresponding to the second page address from each of the first response data stored locally, with respect to the obtained second page address of the page to be displayed of the application, so as to obtain the second page code file corresponding to the second page address and the second resource address after the original resource address identifier in the second page code file is modified based on the verification result;确定模块,用于在所述第二资源地址对应的标识为预设标识的情况下,从本地存储的各第一资源地址对应的资源中匹配出所述第二资源地址对应的资源;a determination module, configured to match the resource corresponding to the second resource address from the resources corresponding to the first resource addresses stored locally when the identifier corresponding to the second resource address is a preset identifier;所述确定模块,用于在所述第二资源地址对应的标识不为预设标识的情况下,向所述应用程序对应的服务端发送资源获取请求,以获取所述第二资源地址对应的资源;The determining module is configured to send a resource acquisition request to a server corresponding to the application program to acquire a resource corresponding to the second resource address when the identifier corresponding to the second resource address is not a preset identifier;渲染模块,用于基于所述第二资源地址对应的资源进行所述待展示页面的渲染;A rendering module, used for rendering the page to be displayed based on the resource corresponding to the second resource address;其中,所述预加载模块,用于:基于所述第一页面地址列表中各第一页面地址进行页面预处理,以获取每个所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址;在本地存储中不存在任一第一资源地址对应的资源的情况下,基于所述任一第一资源地址对应的原资源地址,向所述应用程序对应的服务端发送资源获取请求;接收所述服务端发送的所述任一第一资源地址对应的资源;将各所述第一页面地址对应的第一页面代码文件及第一响应数据、各所述第一页面代码文件中原资源地址标识修改后的第一资源地址、各所述第一资源地址对应的资源,关联存储在本地存储中;Wherein, the preloading module is used to: perform page preprocessing based on each first page address in the first page address list to obtain the first page code file and the first response data corresponding to each first page address, and the first resource address after the original resource address identifier in each first page code file is modified; when there is no resource corresponding to any first resource address in the local storage, based on the original resource address corresponding to any first resource address, send a resource acquisition request to the server corresponding to the application; receive the resource corresponding to any first resource address sent by the server; associate and store the first page code file and the first response data corresponding to each first page address, the first resource address after the original resource address identifier in each first page code file, and the resource corresponding to each first resource address in the local storage;所述预加载模块,用于:在本地存储中存在所述第一页面地址对应的第一响应数据的情况下,基于所述第一响应数据及所述第一页面地址向所述服务端发送询问请求,以确定所述第一页面地址对应的第一页面代码文件是否更新;在所述第一页面地址对应的第一页面代码文件更新的情况下,获取所述服务端发送的所述第一页面地址对应的更新后的第一页面代码文件,及更新后的第一页面代码文件中包含的更新后的原资源地址;利用所述预设标识替换所述原资源地址中协议类型对应的字符,生成所述原资源地址对应的第一资源地址。The preloading module is used to: when there is first response data corresponding to the first page address in the local storage, send an inquiry request to the server based on the first response data and the first page address to determine whether the first page code file corresponding to the first page address is updated; when the first page code file corresponding to the first page address is updated, obtain the updated first page code file corresponding to the first page address sent by the server, and the updated original resource address contained in the updated first page code file; use the preset identifier to replace the characters corresponding to the protocol type in the original resource address to generate the first resource address corresponding to the original resource address.6.一种电子设备,包括:6. An electronic device comprising:至少一个处理器;以及at least one processor; and与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-4中任一项所述的方法。The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 4.7.一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行根据权利要求1-4中任一项所述的方法。7. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 4.
CN202311086973.7A2023-08-252023-08-25 Page processing method and deviceActiveCN117193907B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202311086973.7ACN117193907B (en)2023-08-252023-08-25 Page processing method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202311086973.7ACN117193907B (en)2023-08-252023-08-25 Page processing method and device

Publications (2)

Publication NumberPublication Date
CN117193907A CN117193907A (en)2023-12-08
CN117193907Btrue CN117193907B (en)2024-08-09

Family

ID=88997145

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202311086973.7AActiveCN117193907B (en)2023-08-252023-08-25 Page processing method and device

Country Status (1)

CountryLink
CN (1)CN117193907B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119621594B (en)*2024-12-062025-09-26一网互通(北京)科技有限公司 Method and device for parallel online operation and testing and debugging of authorization process

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112015485A (en)*2020-08-142020-12-01北京达佳互联信息技术有限公司Page display method and device, electronic equipment and storage medium
CN112306587A (en)*2019-07-152021-02-02腾讯科技(深圳)有限公司Page display processing method and device and terminal equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113419784A (en)*2021-06-282021-09-21未鲲(上海)科技服务有限公司Page resource caching method, device, equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112306587A (en)*2019-07-152021-02-02腾讯科技(深圳)有限公司Page display processing method and device and terminal equipment
CN112015485A (en)*2020-08-142020-12-01北京达佳互联信息技术有限公司Page display method and device, electronic equipment and storage medium

Also Published As

Publication numberPublication date
CN117193907A (en)2023-12-08

Similar Documents

PublicationPublication DateTitle
CN110263275B (en)Method and device for accessing webpage, mobile terminal and storage medium
CN110020278B (en)Page data display and provision method, client and server
CN106055337B (en) An interface generation method and device
CN108460115A (en)Information push method, device, computer equipment and storage medium
CN110019350A (en)Data query method and apparatus based on configuration information
CN111752587B (en) Mini-program batch processing method, device, electronic device, and readable storage medium
CN102780603B (en)Web traffic control method and device
CN111200634B (en)Cache resource linkage updating method, system and server
CN110704381A (en)Data analysis method, device and storage medium
CN114144761B (en) Publishing system, push method, application device, receiving device and service management device
CN103559056A (en)File downloading method and device
CN112187622B (en)Instant message display method and device and server
CN113626512A (en)Data processing method, device, equipment and readable storage medium
US8352442B2 (en)Determination of an updated data source from disparate data sources
CN111125170A (en)Cross-service data acquisition method and device of micro-service and micro-service equipment
CN110059278A (en)Web page configuration method, server and computer readable storage medium
CN112597486A (en)Method for preventing repeated access to Restful API based on Spring
CN105704177A (en)UA identification method and device
CN117193907B (en) Page processing method and device
CN105556918B (en)A kind of resource downloading method and electronic equipment
CN111294288A (en)Traffic identification method and device, application program interface gateway and storage medium
US11017032B1 (en)Document recovery utilizing serialized data
CN111782244A (en) Configuration file update method, device, computer equipment and storage medium
WO2024239757A1 (en)Sub-application running method and apparatus, and computer device and storage medium
US12026508B2 (en)Methods for automated configuration management in platform-as-a-service environments and devices thereof

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp