[go: up one dir, main page]

CN107729452A - Webpage loading method, device, electronic equipment and computer-readable recording medium - Google Patents

Webpage loading method, device, electronic equipment and computer-readable recording medium Download PDF

Info

Publication number
CN107729452A
CN107729452A CN201710929396.1A CN201710929396A CN107729452A CN 107729452 A CN107729452 A CN 107729452A CN 201710929396 A CN201710929396 A CN 201710929396A CN 107729452 A CN107729452 A CN 107729452A
Authority
CN
China
Prior art keywords
loading
webview
parameters
classification
module
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.)
Granted
Application number
CN201710929396.1A
Other languages
Chinese (zh)
Other versions
CN107729452B (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.)
Xi'an Huacheng Zhiyuan Electronic Technology Co ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710929396.1A priority Critical patent/CN107729452B/en
Publication of CN107729452A publication Critical patent/CN107729452A/en
Application granted granted Critical
Publication of CN107729452B publication Critical patent/CN107729452B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

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

本发明提供的一种网页加载方法、装置、电子设备及计算机可读存储介质,涉及计算机领域。所述方法包括:在电子设备的webView类中创建一webView分类;根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;将加载协议添加入所述webView分类;当响应用户操作获取的网页的加载链接通过断言检测之后,向与加载链接对应的服务器发起网络请求;根据对应的服务器反馈信息利用webView分类进行网页数据展示。对各种类型的访问请求无需单独定制加载模式,即可实现快速简单的实现访问加载,高效且实用。

A webpage loading method, device, electronic equipment and computer-readable storage medium provided by the present invention relate to the field of computers. The method includes: creating a webView classification in the webView class of the electronic device; generating a loading protocol according to a plurality of pre-selected parameters for realizing loading pages, wherein the parameters include request object parameters, corresponding request type parameters, The encoding format parameters, download progress parameters and callback status parameters of the loaded webpage; adding the loading protocol to the webView classification; when the loading link of the webpage obtained in response to the user operation passes the assertion detection, initiate a network to the server corresponding to the loading link Request; according to the corresponding server feedback information, use webView classification to display web page data. For various types of access requests, there is no need to customize the loading mode separately, and the access loading can be realized quickly and easily, which is efficient and practical.

Description

网页加载方法、装置、电子设备及计算机可读存储介质Web page loading method, device, electronic device, and computer-readable storage medium

技术领域technical field

本发明涉及计算机领域,具体而言,涉及一种网页加载方法、装置、电子设备及计算机可读存储介质。The present invention relates to the field of computers, in particular to a web page loading method, device, electronic equipment and computer-readable storage medium.

背景技术Background technique

使用安装于电子终端的应用程序加载网页时,通常采用电子终端的系统中自带webVIew去加载对应的网页链接,实现对网页内容的展示。这样的加载方式实现方便,展示效果简单。但是对展示网页的类型(type)和编码格式等都是默认的。因此,对于加载具有特殊的type和编码格式的网页的特殊请求则无法如此方便的进行加载。通常需要根据特殊请求定制加载模式,再进行加载。而这样的方式非常的繁琐,效率较低。When using an application program installed on an electronic terminal to load a webpage, the electronic terminal system usually uses a built-in webVIew to load a corresponding webpage link, so as to display the content of the webpage. This loading method is convenient to implement and the display effect is simple. However, the type (type) and encoding format of the displayed web page are all default. Therefore, a special request for loading a web page with a special type and encoding format cannot be loaded so conveniently. It is usually necessary to customize the loading mode according to special requests, and then load. However, this method is very cumbersome and inefficient.

发明内容Contents of the invention

本发明的目的在于提供一种网页加载方法、装置、电子设备及计算机可读存储介质,用以改善上述问题。The object of the present invention is to provide a webpage loading method, device, electronic equipment and computer-readable storage medium to improve the above problems.

为了实现上述目的,本发明实施例采用的技术方案如下:In order to achieve the above object, the technical solution adopted in the embodiment of the present invention is as follows:

第一方面,本发明实施例提供一种网页加载方法,应用于电子设备,所述方法包括:在所述电子设备的webView类中创建一webView分类;根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。In the first aspect, the embodiment of the present invention provides a method for loading a web page, which is applied to an electronic device. The method includes: creating a webView classification in the webView class of the electronic device; The parameters of the page generate a loading protocol, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of loaded webpages, download progress parameters and callback status parameters; adding the loading protocol to the webView classification, To make the webView classify webpages corresponding to multiple types of access requests; when the loading link of the webpage acquired in response to user operation passes assertion detection, initiate a network request to the server corresponding to the loading link; according to the corresponding The server feedback information uses the webView classification to display webpage data.

第二方面,本发明实施例还提供一种网页加载装置,应用于电子设备,所述装置包括:创建模块、生成模块、添加模块、发送模块及展示模块。其中,创建模块,用于在所述电子设备的webView类中创建一webView分类;生成模块,用于根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;添加模块,用于将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;发送模块,用于当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;展示模块,用于根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。In the second aspect, the embodiment of the present invention also provides a webpage loading device, which is applied to electronic equipment, and the device includes: a creating module, a generating module, an adding module, a sending module and a display module. Wherein, the creation module is used to create a webView category in the webView class of the electronic device; the generation module is used to generate a loading protocol according to a plurality of pre-selected parameters for realizing loading pages, wherein the parameters include request Object parameters, corresponding request type parameters, encoding format parameters of loaded webpages, download progress parameters and callback status parameters; adding module for adding the loading protocol to the webView classification, so that the webView classification is used for displaying webpages corresponding to multiple types of access requests; a sending module, configured to initiate a network request to a server corresponding to the loading link after the loading link of the webpage obtained in response to user operations passes assertion detection; a display module, configured to initiate a network request according to the The corresponding server feedback information uses the webView classification to display webpage data.

第三方面,本发明实施例还提供一种电子设备,所述电子设备包括:存储器;处理器;以及网页加载装置,所述网页加载装置存储于所述存储器中并包括一个或多个由所述处理器执行的软件功能模组,其包括:创建模块,用于在所述电子设备的webView类中创建一webView分类;生成模块,用于根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;添加模块,用于将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;发送模块,用于当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;展示模块,用于根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示;查询模块,用于查询所述电子设备当前的网络请求进程;处理模块,用于当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。In the third aspect, the embodiment of the present invention also provides an electronic device, the electronic device includes: a memory; a processor; and a webpage loading device, the webpage loading device is stored in the memory and includes one or more A software function module executed by the processor, which includes: a creation module for creating a webView category in the webView class of the electronic device; a generation module for realizing loading of pages according to a plurality of pre-selected Parameters, generating a loading protocol, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of loaded webpages, download progress parameters and callback status parameters; an adding module is used to add the loading protocol to the webView classification, so that the webView classification is used to display webpages corresponding to multiple types of access requests; the sending module is used to initiate to the server corresponding to the loading link when the loading link of the webpage obtained in response to the user operation is detected by the assertion A network request; a display module, for displaying webpage data by using the webView classification according to the corresponding server feedback information; a query module, for querying the current network request process of the electronic device; a processing module, for when the When there is already a network request corresponding to the loading link in the network request process, cancel sending the network request again.

第四方面,本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述接口测试方法。In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above interface testing method is implemented.

与现有技术相比,本发明提供的一种网页加载方法、装置、电子设备及计算机可读存储介质。首先在所述电子设备的webView类中创建一webView分类;其次,创建对应的加载协议与所述webView分类进行绑定,其中,加载协议根据请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数生成,以便通过简单的使用webView分类即可对多种类型的访问请求对应的网页进行加载。当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求,根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。对各种类型的访问请求无需单独定制加载模式,即可实现快速简单的实现访问加载。Compared with the prior art, the present invention provides a webpage loading method, device, electronic equipment and computer-readable storage medium. First create a webView classification in the webView class of the electronic device; secondly, create a corresponding loading protocol to bind to the webView classification, wherein the loading protocol is based on the request object parameter, the corresponding request type parameter, and the loaded web page Encoding format parameters, download progress parameters and callback status parameters are generated, so that web pages corresponding to various types of access requests can be loaded by simply using webView classification. After the loading link of the webpage obtained in response to the user operation passes the assertion detection, a network request is initiated to the server corresponding to the loading link, and the webpage data is displayed by using the webView classification according to the corresponding server feedback information. For various types of access requests, there is no need to customize the loading mode separately, and the access loading can be realized quickly and easily.

为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present invention more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.

图1为本发明较佳实施例提供的电子设备的方框示意图。Fig. 1 is a schematic block diagram of an electronic device provided by a preferred embodiment of the present invention.

图2示出了本发明较佳实施例提供的网页加载方法的步骤流程图。Fig. 2 shows a flow chart of the steps of the web page loading method provided by the preferred embodiment of the present invention.

图3为图2中步骤S102的子步骤流程图。FIG. 3 is a flowchart of sub-steps of step S102 in FIG. 2 .

图4为图2中步骤S103的子步骤流程图。FIG. 4 is a flowchart of sub-steps of step S103 in FIG. 2 .

图5为图2中步骤S108的子步骤流程图。FIG. 5 is a flow chart of the sub-steps of step S108 in FIG. 2 .

图6示出了本发明较佳实施例提供的网页加载装置的示意图。Fig. 6 shows a schematic diagram of a webpage loading device provided by a preferred embodiment of the present invention.

图7为图6中生成模块的功能子模块示意图。FIG. 7 is a schematic diagram of functional sub-modules of the generating module in FIG. 6 .

图8为图6中添加模块的功能子模块示意图。FIG. 8 is a schematic diagram of functional sub-modules of the added module in FIG. 6 .

图9为图6中展示模块的功能子模块示意图。FIG. 9 is a schematic diagram of functional sub-modules of the module shown in FIG. 6 .

图标:100-电子设备;101-存储器;102-存储控制器;103-处理器;200-网页加载装置;201-创建模块;202-生成模块;2021-生成子模块;2022-选择子模块;203-添加模块;2031-写入子模块;2032-绑定子模块;204-检测模块;205-查询模块;206-处理模块;207-发送模块;208-展示模块;2081-获取子模块;2082-展示子模块。Icons: 100-electronic equipment; 101-memory; 102-storage controller; 103-processor; 200-webpage loading device; 201-create module; 202-generate module; 2021-generate submodule; 2022-select submodule; 203-add module; 2031-write sub-module; 2032-bind sub-module; 204-detection module; 205-query module; 206-processing module; 207-send module; 208-display module; 2082-Display submodule.

具体实施方式detailed description

下面将结合本发明实施例中附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. The components of the embodiments of the invention generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations. Accordingly, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present invention.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本发明的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

请参照图1,图1示出了本发明实施例提供的电子设备100的方框示意图。电子设备100可以是,但不限于智能手机、平板电脑、膝上型便携计算机、车载电脑、个人数字助理(personal digital assistant,PDA)、穿戴式移动终端等等。所述电子设备100安装有iOS系统,其包括网页加载装置200、存储器101、存储控制器102及处理器103。Please refer to FIG. 1 , which shows a schematic block diagram of an electronic device 100 provided by an embodiment of the present invention. The electronic device 100 may be, but not limited to, a smart phone, a tablet computer, a laptop computer, a vehicle computer, a personal digital assistant (personal digital assistant, PDA), a wearable mobile terminal, and the like. The electronic device 100 is installed with an iOS system, which includes a web page loading device 200 , a memory 101 , a storage controller 102 and a processor 103 .

所述存储器101、存储控制器102及处理器103各元件相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。所述网页加载装置200包括至少一个可以软件或固件(firmware)的形式存储于所述存储器101中或固化在所述电子设备100的操作系统(operating system,OS)中的软件功能模块。所述处理器103用于执行存储器101中存储的可执行模块,例如所述网页加载装置200包括的软件功能模块或计算机程序。The components of the memory 101 , the storage controller 102 and the processor 103 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The webpage loading apparatus 200 includes at least one software function module that can be stored in the memory 101 in the form of software or firmware (firmware) or solidified in the operating system (operating system, OS) of the electronic device 100 . The processor 103 is configured to execute executable modules stored in the memory 101 , such as software function modules or computer programs included in the webpage loading device 200 .

其中,存储器101可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-OnlyMemory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。其中,存储器101用于存储程序,所述处理器103在接收到执行指令后,执行所述程序,本发明任一实施例揭示的流程定义的服务器所执行的方法可以应用于处理器103中,或者由处理器103实现。Wherein, memory 101 can be, but not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-OnlyMemory, PROM), erasable In addition to read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. Wherein, the memory 101 is used to store a program, and the processor 103 executes the program after receiving an execution instruction, and the method performed by the process definition server disclosed in any embodiment of the present invention can be applied to the processor 103, Or implemented by the processor 103 .

处理器103可以是一种集成电路芯片,具有信号处理能力。上述的处理器103可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(NetworkProcessor,NP)、语音处理器以及视频处理器等;还可以是数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器103也可以是任何常规的处理器103等。The processor 103 may be an integrated circuit chip with signal processing capabilities. Above-mentioned processor 103 can be general-purpose processor, comprises central processing unit (Central Processing Unit, CPU), network processor (NetworkProcessor, NP), speech processor and video processor etc.; Integrated circuits, field programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor 103 may be any conventional processor 103 or the like.

第一实施例first embodiment

请参考图2,图2示出了本发明实施例提供的一种网页加载方法。所述方法应用于所述电子设备100,用于实现安装于所述电子设备100中的应用程序加载网页页面。如图2所示,所述网页加载方法包括以下步骤:Please refer to FIG. 2 , which shows a method for loading a webpage provided by an embodiment of the present invention. The method is applied to the electronic device 100, and is used for implementing the application program installed in the electronic device 100 to load a web page. As shown in Figure 2, the web page loading method includes the following steps:

步骤S101,在所述电子设备100的webView类中创建一webView分类。Step S101 , creating a webView category in the webView class of the electronic device 100 .

在本实施例中,为了实现更好的对电子设备100自带的webView进行无缝的对接和扩充,在电子设备100中定义一个webView的分类。通过创建webView分类可以在原来的webView类的基础上扩充功能,耦合性很小。需要说明的是,webView类可以是一个展示网页的View,这是一个基础类,使应用程序可以简单的展示内容。webView分类也是一种格式的文件,定义webView分类可以是在原有的webView类的基础上重新定义一个类,实现对原有的webView类进行方法扩充或者是功能的扩充。In this embodiment, in order to achieve better seamless docking and expansion of the webView that comes with the electronic device 100 , a category of webView is defined in the electronic device 100 . By creating a webView category, the functions can be expanded on the basis of the original webView class, and the coupling is very small. It should be noted that the webView class can be a View that displays web pages, which is a basic class that allows applications to easily display content. The webView classification is also a format file. The definition of the webView classification can be to redefine a class on the basis of the original webView class, so as to realize the method expansion or function expansion of the original webView class.

步骤S102,根据预先选定的多个用于实现加载页面的参数,生成加载协议。Step S102, generating a loading protocol according to a plurality of pre-selected parameters for realizing loading a page.

在本实施例中,预先选定的参数可以包括请求对象参数(例如,请求对象request)、对应的请求类型参数(例如,请求加载网页的类型type)、被加载网页的编码格式参数、下载进度参数及回调状态参数。需要说明的是,请求对象参数可以是NSURLRequest类型的参数。所述请求类型参数不能为空,因此,可以设定为nullable类型参数;所述回调状态参数可以包括成功回调参数及失败回调参数,失败回调参数也不能为空,因此,将失败回调参数也定义为nullable类型参数。根据这些参数即可实现对多种类型的网页加载展示。如图3所示,步骤S102包括以下子步骤:In this embodiment, the pre-selected parameters may include request object parameters (for example, request object request), corresponding request type parameters (for example, the type type of the webpage requested to be loaded), encoding format parameters of the loaded webpage, and download progress parameters and callback status parameters. It should be noted that the request object parameter may be a parameter of NSURLRequest type. The request type parameter cannot be empty, so it can be set as a nullable type parameter; the callback status parameter can include success callback parameters and failure callback parameters, and the failure callback parameters cannot be empty, so the failure callback parameters are also defined It is a nullable type parameter. According to these parameters, various types of web pages can be loaded and displayed. As shown in Figure 3, step S102 includes the following sub-steps:

子步骤S1021,根据预先选定的多个所述参数生成一协议声明,以便获取与每个所述参数对应的数据获取接口。Sub-step S1021, generating a protocol statement according to a plurality of pre-selected parameters, so as to obtain a data acquisition interface corresponding to each of the parameters.

在本实施例中,协议声明是对webView分类的功能的一个很精简的描述。作为一种实施例,协议声明可以包括定义个方法名为loadRequest的方法。该loadRequest的方法对应选定的多个参数。协议声明根据选定的参数生成与每个所述参数对应的数据获取接口。In this embodiment, the protocol declaration is a very concise description of the functions classified by webView. As an example, the protocol declaration may include defining a method called loadRequest. The loadRequest method corresponds to the selected multiple parameters. The protocol statement generates a data acquisition interface corresponding to each parameter according to the selected parameters.

子步骤S1022,选择加载协议对应的进行赋值的方法及获取值的方法。Sub-step S1022, select a method for assigning a value and a method for obtaining a value corresponding to the loading protocol.

作为一种实施方式,赋值的方法可以选择对象关联方法objc_setAssociatedObject实现的。具体地,给这个对象关联方法对应四个参数。第一个参数是self;第二个参数可以是赋值方法的key及这个key选择器类型的@selector,即这个key是一个方法的名字;第三个参数可以是需要拿来赋值的参数的名字;第四个参数是关联的策略,此处关联的策略对象是对象类型的,使用类型OBJC_ASSOCIATION_RETAIN_NONATOMIC,获取值的方法也可以使用关联对象方法objc_getAssociatedObject,原理同上,在此不再赘述。As an implementation, the assignment method may be implemented by the object association method objc_setAssociatedObject. Specifically, there are four parameters corresponding to this object association method. The first parameter is self; the second parameter can be the key of the assignment method and the @selector of the key selector type, that is, the key is the name of a method; the third parameter can be the name of the parameter that needs to be assigned ; The fourth parameter is the associated strategy. The associated strategy object here is an object type, using the type OBJC_ASSOCIATION_RETAIN_NONATOMIC. The method of obtaining the value can also use the associated object method objc_getAssociatedObject. The principle is the same as above, so I won’t go into details here.

步骤S103,将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页。Step S103, adding the loading protocol to the webView category, so that the webView category is used to display webpages corresponding to multiple types of access requests.

在本实施例中,webView分类被定义后不能自动获取对应的协议,实现其需要实现的功能。因此,可以通过如图4所示的子流程实现,所述步骤S103包括以下子步骤:In this embodiment, after the webView category is defined, the corresponding protocol cannot be automatically acquired to realize the required functions. Therefore, it can be realized through the sub-flow shown in Figure 4, and the step S103 includes the following sub-steps:

子步骤S1031,将所述协议声明写入所述webView分类的头文件。Sub-step S1031, writing the protocol declaration into the header file of the webView category.

子步骤S1032,使用将所述赋值的方法、获取值的方法及所述webView分类绑定。Sub-step S1032, use the method of assigning value, the method of obtaining value and the webView category to bind.

步骤S104,利用断言检测检验所述电子设备100响应用户操作获取的网页的加载链接。Step S104 , using assertion detection to check the loading link of the webpage acquired by the electronic device 100 in response to the user operation.

在本实施例中,电子设备100响应用户操作获取需打开的网页的加载链接。例如,用户在使用应用程序的过程中,通过点击操作以使电子设备100获取到用户需要打开的网页的加载链接。再通过断言检测判断该加载链接是否有效,避免对无效加载链接的加载。In this embodiment, the electronic device 100 acquires the loading link of the webpage to be opened in response to the user operation. For example, during the process of using the application program, the user can obtain the loading link of the webpage that the user needs to open by clicking on the electronic device 100 . Then judge whether the loading link is valid through assertion detection, so as to avoid loading of invalid loading links.

作为一种实施例,通过所述协议声明中生成的与请求对象参数对应的数据获取接口从加载链接中获取对应的请求对象参数。再通过NSParameterAssert方法检验获取的对应的请求对象参数是否有效。若检验未通过,且电子设备100在debug模式下,则进行异常提醒;在release模式则下进行异常提醒。若检验通过,流程进入步骤S105。As an embodiment, the corresponding request object parameter is obtained from the loading link through the data acquisition interface corresponding to the request object parameter generated in the protocol declaration. Then use the NSParameterAssert method to check whether the obtained corresponding request object parameters are valid. If the inspection fails and the electronic device 100 is in the debug mode, an abnormality reminder is issued; in the release mode, an abnormality reminder is performed. If the check is passed, the process goes to step S105.

步骤S105,查询所述电子设备100当前的网络请求进程。Step S105 , querying the current network request process of the electronic device 100 .

在本实施例中,网络请求进程的堆栈中可以存在等待发送的网络请求,也可以存在正在运行的网络请求。作为一种实施例,可以是通过判断当前的网络状态state堆栈中查看,若当前的状态是存在运行与webView分类从加载链接中获取的请求对象参数对应的运行的NSURLSessionTaskStateRunning或者悬挂的NSURLSessionTaskStateSuspended。In this embodiment, there may be network requests waiting to be sent in the stack of the network request process, or running network requests. As an embodiment, it can be checked by judging the current network status state stack, if the current status is running NSURLSessionTaskStateRunning or suspended NSURLSessionTaskStateSuspended corresponding to the request object parameter obtained from the loading link by webView classification.

步骤S106,当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。Step S106, when there is already a network request corresponding to the loading link in the network request process, cancel sending the network request again.

在本实施例中,若在网络请求进程的堆栈中已经存在与本次需要发送的网络请求相同的网络请求正在运行或悬挂等待,则取消再次发送所述网络请求,避免重复发送网络请求,流程结束。In this embodiment, if the same network request as the network request that needs to be sent this time already exists in the stack of the network request process and is running or pending, then cancel sending the network request again to avoid repeatedly sending the network request. End.

作为一种实施例,可以通webView分类对应的获取值的方法获取再次发送的网络请求,并对该请求执行取消处理,再次准备发送的网络请求取消之后将当前的网络请求任务置为nil。As an embodiment, the network request to be sent again can be obtained through the method of obtaining the value corresponding to the webView classification, and the request can be canceled. After the network request to be sent again is canceled, the current network request task can be set to nil.

在本实施例中,若所述网络请求进程内不存在与所述加载链接对应的网络请求时,流程进入步骤S107。In this embodiment, if there is no network request corresponding to the loading link in the network request process, the process proceeds to step S107.

步骤S107,向与所述加载链接对应的服务器发起网络请求。Step S107, initiate a network request to the server corresponding to the loading link.

步骤S108,根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。Step S108, using the webView classification to display webpage data according to the corresponding server feedback information.

在本实施例中,请求失败则服务器向电子设备100发送的反馈信息包括失败回调信息,所述webView分类根据反馈的数据通过与回调状态参数对应的数据获取接口获得失败回调参数,进行失败提醒;请求成功,则如图5所示,步骤S108包括以下子步骤:In this embodiment, if the request fails, the feedback information sent by the server to the electronic device 100 includes failure callback information, and the webView classification obtains the failure callback parameter through the data acquisition interface corresponding to the callback status parameter according to the feedback data, and performs a failure reminder; If the request is successful, then as shown in Figure 5, step S108 includes the following sub-steps:

子步骤S1081,利用所述数据获取接口及反馈信息获取对应的参数值。Sub-step S1081, using the data acquisition interface and feedback information to acquire corresponding parameter values.

在本实施例中,利用与请求对象参数对应的数据获取接口获取请求对象参数值,作为一种实施例,请求对象参数值可以是加载链接的absoluteString属性;利用与对应的请求类型参数对应的数据获取接口获取需加载网页的请求类型;利用与被加载网页的编码格式参数对应的数据获取接口获取需加载网页的编码格式;利用与下载进度参数对应的数据获取接口获取对反馈信息的下载进度参数;利用与回调状态参数对应的数据获取本次网络请求的回调状态参数。In this embodiment, use the data acquisition interface corresponding to the request object parameter to obtain the request object parameter value. As an embodiment, the request object parameter value can be the absoluteString attribute of the loading link; use the data corresponding to the corresponding request type parameter Get the request type of the web page to be loaded through the acquisition interface; use the data acquisition interface corresponding to the encoding format parameter of the loaded web page to obtain the encoding format of the web page to be loaded; use the data acquisition interface corresponding to the download progress parameter to obtain the download progress parameter of the feedback information ; Use the data corresponding to the callback status parameter to obtain the callback status parameter of this network request.

子步骤S1082,根据获取到的所述参数值,对所述反馈信息进行数据展示。Sub-step S1082, performing data presentation on the feedback information according to the obtained parameter values.

作为一种实施方式,当请求成功时,将获得的反馈信息,再利用webView分类的加载数据的方法loadData对数据进行展示,同时将获取的请求类型及编码格式参数,将这些参数传送至webView分类中方法loadData方法,以便加载网页。加载完毕后,使用webView分类调用webViewDidFinishLoad方法,完成展示。As an implementation, when the request is successful, the obtained feedback information is displayed using the method loadData of the webView category to load data, and at the same time, the obtained request type and encoding format parameters are transmitted to the webView category The method loadData method in order to load the web page. After loading, use the webView category to call the webViewDidFinishLoad method to complete the display.

第二实施例second embodiment

请参考图6,图6是本发明较佳实施例提供的网页加载装置200的示意图。如图6所示,网页加载装置200包括创建模块201、生成模块202、添加模块203、检测模块204、查询模块205、处理模块206、发送模块207及展示模块208。Please refer to FIG. 6 , which is a schematic diagram of a webpage loading device 200 provided by a preferred embodiment of the present invention. As shown in FIG. 6 , the web page loading device 200 includes a creation module 201 , a generation module 202 , an addition module 203 , a detection module 204 , a query module 205 , a processing module 206 , a sending module 207 and a display module 208 .

创建模块201,用于在所述电子设备100的webView类中创建一webView分类。The creating module 201 is configured to create a webView category in the webView class of the electronic device 100 .

在本发明实施例中,步骤S101可以由创建模块201执行。In the embodiment of the present invention, step S101 may be executed by the creation module 201 .

生成模块202,用于根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数。The generating module 202 is configured to generate a loading protocol according to a plurality of pre-selected parameters for realizing page loading, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of loaded web pages, and download progress parameters and callback status parameters.

在本发明实施例中,步骤S102可以由生成模块202执行。如图7所示,生成模块202包括以下功能子模块:In the embodiment of the present invention, step S102 may be executed by the generation module 202 . As shown in Figure 7, the generating module 202 includes the following functional submodules:

生成子模块2021,用于根据预先选定的多个所述参数生成一协议声明,以便获取与每个所述参数对应的数据获取接口。The generation sub-module 2021 is configured to generate a protocol statement according to a plurality of pre-selected parameters, so as to obtain a data acquisition interface corresponding to each of the parameters.

在本发明实施例中,子步骤S1021可以由生成子模块2021执行。In this embodiment of the present invention, sub-step S1021 may be performed by the generation sub-module 2021 .

选择子模块2022,用于选择加载协议对应的进行赋值的方法及获取值的方法。The selection sub-module 2022 is used to select a method of assigning a value and a method of obtaining a value corresponding to the loading protocol.

在本发明实施例中,子步骤S1022可以由选择子模块2022执行。In this embodiment of the present invention, sub-step S1022 may be performed by the selection sub-module 2022 .

添加模块203,用于将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页。The adding module 203 is configured to add the loading protocol to the webView category, so that the webView category is used to display webpages corresponding to multiple types of access requests.

在本发明实施例中,步骤S103可以由添加模块203执行。如图8所示,所示添加模块203可以包括以下功能子模块:In the embodiment of the present invention, step S103 may be performed by the adding module 203 . As shown in FIG. 8, the added module 203 may include the following functional submodules:

写入子模块2031,用于将所述协议声明写入所述webView分类的头文件。The writing submodule 2031 is used to write the protocol statement into the header file of the webView category.

在本发明实施例中,子步骤S1031可以由写入子模块2031执行。In the embodiment of the present invention, sub-step S1031 may be performed by the writing sub-module 2031 .

绑定子模块2032,用于使用将所述赋值的方法、获取值的方法及所述webView分类绑定。The binding sub-module 2032 is used to bind the method of assigning value, the method of obtaining value and the webView category.

在本发明实施例中,子步骤S1032可以由绑定子模块2032执行。In this embodiment of the present invention, substep S1032 may be performed by the binding submodule 2032 .

检测模块204,用于利用断言检测检验所述电子设备100响应用户操作获取的网页的加载链接。The detection module 204 is configured to use assertion detection to verify the loading link of the webpage acquired by the electronic device 100 in response to a user operation.

在本发明实施例中,步骤S104可以由检测模块204执行。In the embodiment of the present invention, step S104 may be executed by the detection module 204 .

查询模块205,用于查询所述电子设备100当前的网络请求进程。The query module 205 is configured to query the current network request process of the electronic device 100 .

在本发明实施例中,步骤S105可以由查询模块205执行。In the embodiment of the present invention, step S105 may be executed by the query module 205 .

处理模块206,用于当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。The processing module 206 is configured to cancel sending the network request again when there is a network request corresponding to the loading link in the network request process.

在本发明实施例中,步骤S106可以由处理模块206执行。In the embodiment of the present invention, step S106 may be executed by the processing module 206 .

发送模块207,向与所述加载链接对应的服务器发起网络请求。The sending module 207 initiates a network request to the server corresponding to the loading link.

在本发明实施例中,步骤S107可以由发送模块207执行。具体地,当响应用户操作获取的网页的加载链接通过断言检测之后,且所述网络请求进程内不存在与所述加载链接对应的网络请求时执行步骤S107。In this embodiment of the present invention, step S107 may be performed by the sending module 207 . Specifically, step S107 is executed when the loading link of the webpage obtained in response to the user operation passes the assertion detection and there is no network request corresponding to the loading link in the network request process.

展示模块208,用于根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。The display module 208 is configured to use the webView classification to display web page data according to the corresponding server feedback information.

在本发明实施例中,步骤S108可以由展示模块208执行。如图9所示,展示模块208包块以下功能子模块:In the embodiment of the present invention, step S108 may be performed by the presentation module 208 . As shown in Figure 9, the display module 208 includes the following functional sub-modules:

获取子模块2081,用于利用所述数据获取接口及反馈信息获取对应的参数值。The obtaining sub-module 2081 is configured to use the data obtaining interface and feedback information to obtain corresponding parameter values.

在本发明实施例中,子步骤S1081可以由获取子模块2081执行。In this embodiment of the present invention, substep S1081 may be performed by the obtaining submodule 2081.

展示子模块2082,用于根据获取到的所述参数值,对所述反馈信息进行数据展示。The presentation sub-module 2082 is configured to perform data presentation on the feedback information according to the acquired parameter values.

在本发明实施例中,子步骤S1082可以由展示子模块2082执行。In the embodiment of the present invention, sub-step S1082 may be performed by the presentation sub-module 2082 .

本发明实施例还揭示了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器103执行时实现本发明前述实施例揭示的接口测试方法。The embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor 103, the interface testing method disclosed in the foregoing embodiments of the present invention is implemented.

综上所述,本发明提供的一种网页加载方法、装置、电子设备及计算机可读存储介质,应用于电子设备。所述方法包括:在所述电子设备的webView类中创建一webView分类;根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。对各种类型的访问请求无需单独定制加载模式,即可实现快速简单的实现访问加载。To sum up, the present invention provides a web page loading method, device, electronic equipment, and computer-readable storage medium, which are applied to electronic equipment. The method includes: creating a webView classification in the webView class of the electronic device; generating a loading protocol according to a plurality of pre-selected parameters for realizing loading pages, wherein the parameters include request object parameters and corresponding request types Parameters, encoding format parameters of loaded web pages, download progress parameters and callback status parameters; adding the loading protocol to the webView classification, so that the webView classification is used to display web pages corresponding to multiple types of access requests; when responding to the user After the loading link of the webpage acquired through the operation is detected by the assertion, a network request is initiated to the server corresponding to the loading link; according to the corresponding server feedback information, the webView classification is used to display webpage data. For various types of access requests, there is no need to customize the loading mode separately, and the access loading can be realized quickly and easily.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本发明的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functions and possible implementations of devices, methods and computer program products according to multiple embodiments of the present invention. operate. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or part of code that includes one or more Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions.

另外,在本发明各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. any such actual relationship or order exists between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention. It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (10)

1.一种网页加载方法,其特征在于,应用于电子设备,所述方法包括:1. A webpage loading method, characterized in that being applied to electronic equipment, the method comprises: 在所述电子设备的webView类中创建一webView分类;Create a webView classification in the webView class of the electronic device; 根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;Generate a loading protocol according to a plurality of pre-selected parameters for realizing loading the page, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of the loaded web page, download progress parameters and callback status parameters; 将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;Adding the loading protocol to the webView classification, so that the webView classification is used to display web pages corresponding to multiple types of access requests; 当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;After the loading link of the webpage acquired in response to the user operation passes the assertion detection, initiate a network request to the server corresponding to the loading link; 根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示。Using the webView classification to display web page data according to the corresponding server feedback information. 2.如权利要求1所述的方法,其特征在于,所述生成加载协议的步骤包括:2. The method according to claim 1, wherein the step of generating the loading protocol comprises: 根据预先选定的多个所述参数生成一协议声明,以便获取与每个所述参数对应的数据获取接口;generating a protocol statement according to a plurality of pre-selected parameters, so as to obtain a data acquisition interface corresponding to each of the parameters; 选择加载协议对应的进行赋值的方法及获取值的方法。Select the method of assigning a value and the method of obtaining a value corresponding to the loading protocol. 3.如权利要求2所述的方法,其特征在于,将所述加载协议添加入所述webView分类的步骤包括:3. The method according to claim 2, wherein the step of adding the loading protocol to the webView classification comprises: 将所述协议声明写入所述webView分类的头文件;Writing the protocol declaration into the header file of the webView category; 使用将所述赋值的方法、获取值的方法及所述webView分类绑定。Use the method of assigning value, the method of obtaining value and the webView classification binding. 4.如权利要求2所述的方法,其特征在于,所述根据所述对应的服务器反馈信息利用所述webView分类进行数据展示的步骤包括:4. The method according to claim 2, wherein the step of using the webView classification to display data according to the corresponding server feedback information comprises: 利用所述数据获取接口及反馈信息获取对应的参数值;Using the data acquisition interface and feedback information to acquire corresponding parameter values; 根据获取到的所述参数值,对所述反馈信息进行数据展示。According to the obtained parameter value, data presentation is performed on the feedback information. 5.如权利要求1所述的方法,其特征在于,在向与所述加载链接对应的服务器发起网络请求之前,所述方法还包括:5. The method according to claim 1, wherein before initiating a network request to a server corresponding to the loading link, the method further comprises: 查询所述电子设备当前的网络请求进程;Query the current network request process of the electronic device; 当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。When there is already a network request corresponding to the loading link in the network request process, cancel sending the network request again. 6.一种网页加载装置,其特征在于,应用于电子设备,所述装置包括:6. A webpage loading device, characterized in that it is applied to electronic equipment, and the device comprises: 创建模块,用于在所述电子设备的webView类中创建一webView分类;Create a module for creating a webView classification in the webView class of the electronic device; 生成模块,用于根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;The generation module is used to generate a loading protocol according to a plurality of pre-selected parameters for realizing loading pages, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of loaded webpages, download progress parameters and callback status parameter; 添加模块,用于将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;Adding a module for adding the loading protocol to the webView classification, so that the webView classification is used to display webpages corresponding to multiple types of access requests; 发送模块,用于当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;A sending module, configured to initiate a network request to a server corresponding to the loading link after the loading link of the webpage acquired in response to the user operation passes the assertion detection; 展示模块,用于根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示;A display module, configured to use the webView classification to display web page data according to the corresponding server feedback information; 查询模块,用于查询所述电子设备当前的网络请求进程;a query module, configured to query the current network request process of the electronic device; 处理模块,用于当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。A processing module, configured to cancel sending the network request again when there is already a network request corresponding to the loading link in the network request process. 7.如权利要求6所述的装置,其特征在于,所述生成模块包括:7. The device according to claim 6, wherein the generating module comprises: 生成子模块,用于根据预先选定的多个所述参数生成一协议声明,以便获取与每个所述参数对应的数据获取接口;generating a submodule, configured to generate a protocol statement according to a plurality of pre-selected parameters, so as to obtain a data acquisition interface corresponding to each of the parameters; 选择子模块,用于选择加载协议对应的进行赋值的方法及获取值的方法。Select the submodule, which is used to select the method of assigning and obtaining the value corresponding to the loading protocol. 8.如权利要求7所述的装置,其特征在于,所述添加模块包括:8. The device according to claim 7, wherein the adding module comprises: 写入子模块,用于将所述协议声明写入所述webView分类的头文件;Writing into a submodule for writing the protocol declaration into the header file of the webView classification; 绑定子模块,用于使用将所述赋值的方法、获取值的方法及所述webView分类绑定。The binding sub-module is used to bind the method of assigning value, the method of obtaining value and the webView classification. 9.一种电子设备,其特征在于,所述电子设备包括:9. An electronic device, characterized in that the electronic device comprises: 存储器;memory; 处理器;以及processor; and 网页加载装置,所述网页加载装置存储于所述存储器中并包括一个或多个由所述处理器执行的软件功能模组,其包括:A web page loading device, the web page loading device is stored in the memory and includes one or more software function modules executed by the processor, including: 创建模块,用于在所述电子设备的webView类中创建一webView分类;Create a module for creating a webView classification in the webView class of the electronic device; 生成模块,用于根据预先选定的多个用于实现加载页面的参数,生成加载协议,其中,参数包括请求对象参数、对应的请求类型参数、被加载网页的编码格式参数、下载进度参数及回调状态参数;The generation module is used to generate a loading protocol according to a plurality of pre-selected parameters for realizing loading pages, wherein the parameters include request object parameters, corresponding request type parameters, encoding format parameters of loaded webpages, download progress parameters and callback status parameter; 添加模块,用于将所述加载协议添加入所述webView分类,以使所述webView分类用于展示多种类访问请求对应的网页;Adding a module for adding the loading protocol to the webView classification, so that the webView classification is used to display webpages corresponding to multiple types of access requests; 发送模块,用于当响应用户操作获取的网页的加载链接通过断言检测之后,向与所述加载链接对应的服务器发起网络请求;A sending module, configured to initiate a network request to a server corresponding to the loading link after the loading link of the webpage acquired in response to the user operation passes the assertion detection; 展示模块,用于根据所述对应的服务器反馈信息利用所述webView分类进行网页数据展示;A display module, configured to use the webView classification to display web page data according to the corresponding server feedback information; 查询模块,用于查询所述电子设备当前的网络请求进程;a query module, configured to query the current network request process of the electronic device; 处理模块,用于当所述网络请求进程内已存在与所述加载链接对应的网络请求时,则取消再次发送所述网络请求。A processing module, configured to cancel sending the network request again when there is already a network request corresponding to the loading link in the network request process. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现如权利要求1-5中任一项所述的方法。10. A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the method according to any one of claims 1-5 is implemented.
CN201710929396.1A 2017-10-09 2017-10-09 Web page loading method, apparatus, electronic device, and computer-readable storage medium Active CN107729452B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710929396.1A CN107729452B (en) 2017-10-09 2017-10-09 Web page loading method, apparatus, electronic device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710929396.1A CN107729452B (en) 2017-10-09 2017-10-09 Web page loading method, apparatus, electronic device, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN107729452A true CN107729452A (en) 2018-02-23
CN107729452B CN107729452B (en) 2020-07-10

Family

ID=61209964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710929396.1A Active CN107729452B (en) 2017-10-09 2017-10-09 Web page loading method, apparatus, electronic device, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN107729452B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108809763A (en) * 2018-06-14 2018-11-13 武汉斗鱼网络科技有限公司 A kind of network performance parameter acquisition method, terminal installation and storage medium
CN109032693A (en) * 2018-06-29 2018-12-18 北京金山安全软件有限公司 Method and device for loading display information, electronic equipment and readable storage medium
CN109040072A (en) * 2018-08-06 2018-12-18 武汉斗鱼网络科技有限公司 A kind of method, system, server and the storage medium of client authorization log-on webpage
CN109271213A (en) * 2018-08-20 2019-01-25 平安普惠企业管理有限公司 Loading method, device, computer equipment and the storage medium of the HTML5 page
CN109669786A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Interface call method, unit and computer readable storage medium
CN111190592A (en) * 2018-11-15 2020-05-22 武汉斗鱼网络科技有限公司 A page creation method, storage medium, electronic device and system
CN111857855A (en) * 2019-04-01 2020-10-30 苏宁易购集团股份有限公司 Webpage loading method and device and intelligent equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6256635B1 (en) * 1998-05-08 2001-07-03 Apple Computer, Inc. Method and apparatus for configuring a computer using scripting
CN101067819A (en) * 2007-06-07 2007-11-07 北京大学 Method and system for publishing web resources
CN103034504A (en) * 2013-01-05 2013-04-10 湖南经桥网络科技有限公司 Application method and device of template website
CN103425794A (en) * 2013-08-29 2013-12-04 优视科技有限公司 Webpage previewing method and webpage previewing device based on bis-WebView
CN103995694A (en) * 2014-03-31 2014-08-20 中邮科通信技术股份有限公司 Mobile client browser control with telecommunication capacity and calling method thereof
CN104951326A (en) * 2014-03-31 2015-09-30 腾讯科技(深圳)有限公司 Web access method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6256635B1 (en) * 1998-05-08 2001-07-03 Apple Computer, Inc. Method and apparatus for configuring a computer using scripting
CN101067819A (en) * 2007-06-07 2007-11-07 北京大学 Method and system for publishing web resources
CN103034504A (en) * 2013-01-05 2013-04-10 湖南经桥网络科技有限公司 Application method and device of template website
CN103425794A (en) * 2013-08-29 2013-12-04 优视科技有限公司 Webpage previewing method and webpage previewing device based on bis-WebView
CN103995694A (en) * 2014-03-31 2014-08-20 中邮科通信技术股份有限公司 Mobile client browser control with telecommunication capacity and calling method thereof
CN104951326A (en) * 2014-03-31 2015-09-30 腾讯科技(深圳)有限公司 Web access method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JUSTSON: "WebView封装", 《HTTPS://WWW.JIANSHU.COM/P/D657580AC643》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108809763A (en) * 2018-06-14 2018-11-13 武汉斗鱼网络科技有限公司 A kind of network performance parameter acquisition method, terminal installation and storage medium
CN109032693A (en) * 2018-06-29 2018-12-18 北京金山安全软件有限公司 Method and device for loading display information, electronic equipment and readable storage medium
CN109032693B (en) * 2018-06-29 2021-09-24 北京金山安全软件有限公司 Method and device for loading display information, electronic equipment and readable storage medium
CN109040072A (en) * 2018-08-06 2018-12-18 武汉斗鱼网络科技有限公司 A kind of method, system, server and the storage medium of client authorization log-on webpage
CN109040072B (en) * 2018-08-06 2021-03-12 武汉斗鱼网络科技有限公司 A method, system, server and storage medium for client authorization to log in to webpage
CN109271213A (en) * 2018-08-20 2019-01-25 平安普惠企业管理有限公司 Loading method, device, computer equipment and the storage medium of the HTML5 page
CN109271213B (en) * 2018-08-20 2023-03-28 平安普惠企业管理有限公司 HTML5 page loading method and device, computer equipment and storage medium
CN109669786A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Interface call method, unit and computer readable storage medium
CN111190592A (en) * 2018-11-15 2020-05-22 武汉斗鱼网络科技有限公司 A page creation method, storage medium, electronic device and system
CN111190592B (en) * 2018-11-15 2022-06-21 武汉斗鱼网络科技有限公司 A page creation method, storage medium, electronic device and system
CN111857855A (en) * 2019-04-01 2020-10-30 苏宁易购集团股份有限公司 Webpage loading method and device and intelligent equipment
CN111857855B (en) * 2019-04-01 2021-10-29 南京星云数字技术有限公司 Webpage loading method and device and intelligent equipment

Also Published As

Publication number Publication date
CN107729452B (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN107729452B (en) Web page loading method, apparatus, electronic device, and computer-readable storage medium
CN111694572A (en) Code format conversion method, device, computer equipment and storage medium
CN111638873A (en) Program code generation method and device, computer equipment and storage medium
US10630399B2 (en) Testing distributed applications that have an established exchange in an advanced message queuing protocol (AMQP) message broker
AU2017370317A1 (en) Method of detecting transaction system error, device, storage medium, and computer equipment
CN113900725B (en) Interface configuration method, device, computer equipment and storage medium
CN114564203A (en) Service operation method and device, electronic equipment and readable medium
CN111045724B (en) Inquiry method, device and readable storage medium for calling chain information
CN107085530A (en) Method, device and mobile terminal for refreshing application interface
CN111949510A (en) Test processing method, apparatus, electronic device, and readable storage medium
CN112068827A (en) Method, device, system, equipment and medium for generating accessory control
US20150100615A1 (en) Drag and drop of a uri to link resources
CN112306723A (en) Operation information acquisition method and device applied to small program
CN117369866A (en) Parameter verification method, device, equipment and storage medium
KR102723344B1 (en) Method and device for displaying documents
CN112256992B (en) Method and equipment for native rendering of information flow fusing multiple link addresses
CN112068814B (en) Method, device, system and medium for generating executable file
CN107145375A (en) Kernel loads method, device, system, user terminal and storage medium
CN113778434A (en) Multilingual document management method, device, electronic equipment and storage medium
CN115509543B (en) Methods, apparatus, electronic devices and storage media for determining document validity
CN108196841A (en) Annotation symbol adding method, device and electronic equipment
CN111124712A (en) Event notification method, device, server and storage medium
CN112328815B (en) Slide storage method and device
CN114090661A (en) Data transmission method and device, electronic equipment and computer readable storage medium
CN115034182A (en) Page rendering method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20251024

Address after: 710000 Shaanxi Province, Xi'an City, Qujiang New District, Xiyingshi Road, Sumitomo Building, Room 1502, B Block

Patentee after: Xi'an Huacheng Zhiyuan Electronic Technology Co.,Ltd.

Country or region after: China

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before: China