CN104572777B - Webpage loading method and device based on UIWebView component - Google Patents

Webpage loading method and device based on UIWebView component Download PDF

Info

Publication number
CN104572777B
CN104572777B CN201310516807.6A CN201310516807A CN104572777B CN 104572777 B CN104572777 B CN 104572777B CN 201310516807 A CN201310516807 A CN 201310516807A CN 104572777 B CN104572777 B CN 104572777B
Authority
CN
China
Prior art keywords
uiwebview
access requests
component
web page
web access
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
CN201310516807.6A
Other languages
Chinese (zh)
Other versions
CN104572777A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310516807.6A priority Critical patent/CN104572777B/en
Priority to PCT/CN2014/088716 priority patent/WO2015062416A1/en
Publication of CN104572777A publication Critical patent/CN104572777A/en
Application granted granted Critical
Publication of CN104572777B publication Critical patent/CN104572777B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

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

Abstract

The present invention provides a kind of webpage loading methods based on UIWebView component, which comprises the corresponding web page address of the jump instruction is extracted in the jump instruction for obtaining UIWebView component;Web access requests are generated by the UIWebView component according to the web page address;The web access requests are intercepted and captured, search web page resources corresponding with the web access requests in the buffer and generate corresponding response object;The response object is returned into the UIWebView component, the web page resources are obtained by response object described in the UIWebView analyzing component and are loaded it.In addition, additionally providing a kind of device of webpage load based on UIWebView component.Webpage loading velocity can be effectively improved using this method, while saving flow.

Description

Webpage loading method and device based on UIWebView component
Technical field
The present invention relates to Internet technical fields, more particularly to a kind of webpage load side based on UIWebView component Method and device.
Background technique
In existing IOS system, UIWebView component is generally used for according to load linked webpage and with corresponding view It is shown, is equivalent to the function of browser.However, inventor it has been investigated that, the UIWebView component in traditional technology adds At least there are the following problems when support grid page:
UIWebView component in traditional technology in load with input when linking corresponding webpage, regardless of local whether There is caching, it is slower so as to cause loading velocity all in accordance with the corresponding web page resources of links and accesses the Internet download.
Summary of the invention
Based on this, it is necessary to provide a kind of webpage load based on UIWebView component that can improve webpage loading velocity Method.
A kind of webpage loading method based on UIWebView component, comprising:
The jump instruction for obtaining UIWebView component, extracts the corresponding web page address of the jump instruction;
Pass through the web access requests that the UIWebView component generates according to the web page address;
The web access requests are intercepted and captured, search web page resources corresponding with the web access requests and life in the buffer At corresponding response object;
The response object is returned into the UIWebView component, by ringing described in the UIWebView analyzing component Reply is as obtaining the web page resources and loading it.
In addition, there is a need to provide a kind of webpage load based on UIWebView component that can improve webpage loading velocity Device.
A kind of webpage loading device based on UIWebView component, comprising:
Instruction acquisition module extracts the corresponding net of the jump instruction for obtaining the jump instruction of UIWebView component Page address;
Generation module is requested, for passing through the web page access that the UIWebView component generates according to the web page address Request;
Response object generation module is searched and the web page access in the buffer for intercepting and capturing the web access requests It requests corresponding web page resources and generates corresponding response object;
Web page resources loading module, for the response object to be returned to the UIWebView component, by described Response object described in UIWebView analyzing component obtains the web page resources and loads it.
Above-mentioned webpage loading method and device based on UIWebView component intercepts and captures UIWebView component according to generation After web access requests, server is not sent it to directly, but first searches net corresponding with the request in the buffer Page resource saves the time of downloading web page resources, to improve so that data stored in caching reasonably be utilized Webpage loading velocity, while also saving flow.
Detailed description of the invention
Fig. 1 is the flow diagram of the webpage loading method based on UIWebView component in one embodiment;
Fig. 2 is the application scenario diagram of the webpage loading method based on UIWebView component in one embodiment;
Fig. 3 is the application scenario diagram of the webpage loading method based on UIWebView component in one embodiment;
Fig. 4 is the structural schematic diagram of the webpage loading device based on UIWebView component in one embodiment.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.
As shown in Figure 1, in one embodiment, a kind of webpage loading method based on UIWebView component is provided, it should Method places one's entire reliance upon computer program, can run in the computer system based on IOS operating system.
This method comprises the following steps:
Step S102 obtains the jump instruction of UIWebView component, extracts the corresponding web page address of jump instruction.
UIWebView component is a built-in browser control of IOS operating system, can be used to parse html specification definition Web page resources, to realize the common browser function such as loaded and displayed webpage, document.
Jump instruction is the instruction that UIWebView component carries out page switching.When user can be by inputting word in address field Symbol string or the link clicked on the page input web page address (as url, Universal Resource to UIWebView component Locator, uniform resource locator), UIWebView component detection can then give birth to when having web page address input and changing At jump instruction.User can also generate jump instruction by clicking the forward or backward button on UIWebView component, jump Instructing corresponding web page address is the url of the page of previous or rear browsing.
Step S104, the web access requests generated according to web page address by UIWebView component.
In the present embodiment, can by generate httprequest object, and using the corresponding web page address of jump instruction as Destination address is assigned to the httprequest object to generate web access requests.Generating can be by it after the web access requests It is sent to the corresponding server of network address.
Step S106 intercepts and captures web access requests, searches web page resources corresponding with web access requests simultaneously in the buffer Generate corresponding response object.
In the present embodiment, it can be sent in function in the request in UIWebView component and code is added, to the web page access Request is intercepted.The caching of UIWebView component, can be slow usually by the corresponding storage of the web page resources of web page address and caching It deposits and is searched in the buffer according to the destination address in web access requests, if finding, generate httpresponse pairs As, and the web page resources found are assigned to the httpresponse object.
In the present embodiment, if not finding the corresponding web page resources of web access requests, web access requests are initiated, And the web page resources for receiving return generate corresponding response object.
That is, first searching web access requests before the request transmission function in UIWebView component is called Corresponding web page resources generate response object according to the web page resources found if finding;If not finding, call request It sends function and web access requests is sent to the corresponding server of its destination address, generated and rung according to the data that server returns Reply as.
Response object is returned to UIWebView component by step S108, passes through UIWebView analyzing component response object It obtains web page resources and loads it.
In the present embodiment, which can be according to the web page resources generation found in the buffer, can also When being in the buffer to find, the data for having server to download generate response object.That is, UIWebView component It is not relevant for the origin of the web page resources in the response object included, is called directly in html analytical function resolution response object Web page resources, to load it.
In one embodiment, the step of web access requests being generated by UIWebView component further include: acquisition jumps Corresponding action event is instructed, judges whether action event is advance event or retreats event, if so, in web access requests It is middle that identifier corresponding with action event is added.
The corresponding action event of jump instruction is the action event of user's triggering when generating jump instruction.As previously mentioned, If user inputs jump instruction by the link clicked in the page shown in UIWebView component, action event is link Click event.If user inputs jump instruction by inputting web page address in address field, action event is address field change Event.If user inputs jump instruction, corresponding operation thing by the forward or backward button clicked in UIWebView component Part is advance event or retrogressing event.
Preferably, the step of identifier corresponding with action event is added in web access requests includes: to visit in webpage It asks in the request header of request or the web page address of web-page requests and operation mark is added.
For example, can be in the accept attribute value (being also possible to other attribute values) of the header attribute item of web access requests Identifier of the middle addition forward or back as advance event or retrogressing event.It can also be in the url of web access requests, example (advance as #forward or #back is added after http://www.aaa.com as the identifier of advance event or retrogressing event It is http://www.aaa.com#forward after event addition).
In the present embodiment, after the step of intercepting and capturing web access requests further include: judge whether web access requests are right The event that should advance retreats event, if so, searching web page resources corresponding with web access requests in the buffer.
That is, the web access requests only generated to advance event or retrogressing event execute the step searched in the buffer Suddenly.Due to advance event or retreat the corresponding page of event, it includes the resource files such as picture, video or audio it is inevitable by Caching (when caching does not exhaust), and in the case where not considering resource file, the page only includes text, therefore IOS system is usual The page can be re-downloaded, when the text information amount that the page includes is larger, still when user clicks and moves forward or back button More time can be wasted.And using the above scheme, then it can in view of the foregoing drawbacks, when user clicks and moves forward or back button, still Corresponding web page resources are now searched in the buffer, to save the load time, while also saving flow.
In one embodiment, it when not finding the corresponding web page resources of web access requests in the buffer, can also obtain Receive return web page resources size of data and/or speed of download, and by UIWebView component display data size and/ Or speed of download.
For example, as shown in Fig. 2, when downloading web page resources, can obtain the web page resources size of data and/or under Speed is carried, UIWebView component display data size and/or speed of download are passed through.
In one embodiment, the residual capacity that can also obtain caching shows residual capacity by UIWebView component.
For example, then being opened up by UIWebView component as shown in figure 3, the residual capacity size of caching can be calculated Show.
As shown in figure 4, in one embodiment, a kind of webpage loading device based on UIWebView component, including instruction Module 402 is obtained, generation module 404, response object generation module 406 and web page resources loading module 408 are requested, in which:
Instruction acquisition module 402 extracts the corresponding net of jump instruction for obtaining the jump instruction of UIWebView component Page address.
Generation module 404 is requested, for generating web access requests by UIWebView component according to web page address.
Response object generation module 406 is searched and web access requests pair in the buffer for intercepting and capturing web access requests The web page resources answered simultaneously generate corresponding response object.
Web page resources loading module 408 passes through UIWebView group for response object to be returned to UIWebView component Part resolution response object obtains web page resources and loads it.
In one embodiment, request generation module 404 is also used to obtain the corresponding action event of jump instruction, judges to grasp Make whether event is advance event or retreats event, if so, mark corresponding with action event is added in web access requests Know symbol.
In one embodiment, response object generation module 406 is also used to judge whether web access requests correspond to advance Event retreats event, if so, searching web page resources corresponding with web access requests in the buffer.
In one embodiment, request generation module 404 is also used to request header or web-page requests in web access requests Web page address in operation mark is added.
In one embodiment, if response object generation module 406 be also used to not find web access requests it is corresponding Web page resources then initiate web access requests, and the web page resources for receiving return generate response object.
In one embodiment, a kind of webpage loading device based on UIWebView component further include:
Resource information display module 410, for obtaining the size of data and/or downloading speed that receive the web page resources returned Degree, and pass through UIWebView component display data size and/or speed of download.
In one embodiment, a kind of webpage loading device based on UIWebView component further include:
Cache information display module 412 is shown remaining for obtaining the residual capacity of caching by UIWebView component Capacity.
Above-mentioned webpage loading method and device based on UIWebView component intercepts and captures UIWebView component according to generation After web access requests, server is not sent it to directly, but first searches net corresponding with the request in the buffer Page resource saves the time of downloading web page resources, to improve so that data stored in caching reasonably be utilized Webpage loading velocity, while also saving flow.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program, which can be stored in 20 machine of a calculating, can be read storage Jie In matter, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be Magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously Limitations on the scope of the patent of the present invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the invention Protect range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.

Claims (12)

1. a kind of webpage loading method based on UIWebView component, runs on the computer system based on IOS operating system On, comprising:
The jump instruction for obtaining UIWebView component, extracts the corresponding web page address of the jump instruction;
Web access requests are generated by the UIWebView component according to the web page address;
The web access requests are intercepted and captured, is sent in function in the request in UIWebView component and code is added, to the webpage Access request is intercepted, the request in UIWebView component send function it is called before, search in the buffer with it is described The corresponding web page resources of web access requests if finding, and generate corresponding response object according to the web page resources found;
If not finding, calls the request to send function and web access requests is sent to the corresponding server of destination address, Response object is generated according to the data that server returns;
The response object is returned into the UIWebView component, passes through response pair described in the UIWebView analyzing component As obtaining the web page resources and loading it.
2. the webpage loading method according to claim 1 based on UIWebView component, which is characterized in that described to pass through The UIWebView component generates the step of web access requests further include:
Obtain the corresponding action event of the jump instruction, judge the action event whether be advance event or retreat event, If so, identifier corresponding with action event is added in the web access requests.
3. the webpage loading method according to claim 2 based on UIWebView component, which is characterized in that the intercepting and capturing After the step of web access requests further include:
Judge the web access requests whether correspond to advance event or retreat event, if so, in the buffer search with it is described The corresponding web page resources of web access requests.
4. the webpage loading method according to claim 2 based on UIWebView component, which is characterized in that described in institute Stating the step of identifier corresponding with action event is added in web access requests includes:
Operation mark is added in the request header of the web access requests or the web page address of the web access requests.
5. the webpage loading method according to claim 4 based on UIWebView component, which is characterized in that the method Further include:
The size of data and/or speed of download for receiving the web page resources returned are obtained, and is shown by the UIWebView component The size of data and/or speed of download.
6. the webpage loading method according to any one of claims 1 to 4 based on UIWebView component, which is characterized in that The method also includes:
The residual capacity for obtaining the caching shows the residual capacity by the UIWebView component.
7. a kind of webpage loading device based on UIWebView component, runs on the computer system based on IOS operating system On, comprising:
Instruction acquisition module, for obtaining the jump instruction of UIWebView component, with extracting the corresponding webpage of the jump instruction Location;
Generation module is requested, for generating web access requests by the UIWebView component according to the web page address;
Response object generation module, for intercepting and capturing the web access requests, the request in UIWebView component sends function Middle addition code, intercepts the web access requests, and the request in UIWebView component sends function and is called it Before, web page resources corresponding with the web access requests are searched in the buffer, if finding, and according to the webpage money found Source generates corresponding response object, if not finding, calls the request to send function and web access requests are sent to target The corresponding server in address generates response object according to the data that server returns;
Web page resources loading module, for the response object to be returned to the UIWebView component, by described Response object described in UIWebView analyzing component obtains the web page resources and loads it.
8. the webpage loading device according to claim 7 based on UIWebView component, which is characterized in that the request Generation module is also used to obtain the corresponding action event of the jump instruction, judge the action event whether be advance event or Retrogressing event, if so, identifier corresponding with action event is added in the web access requests.
9. the webpage loading device according to claim 8 based on UIWebView component, which is characterized in that the response Object generation module is also used to judge whether the web access requests correspond to advance event or retreat event, if so, slow Deposit middle lookup web page resources corresponding with the web access requests.
10. the webpage loading device according to claim 8 based on UIWebView component, which is characterized in that the request Generation module is also used to that behaviour is added in the request header of the web access requests or the web page address of the web access requests It makes a check mark.
11. the webpage loading device according to claim 7 based on UIWebView component, which is characterized in that described device Further include resource information display module, for obtaining the size of data and/or speed of download that receive the web page resources returned, and leads to It crosses the UIWebView component and shows the size of data and/or speed of download.
12. according to the described in any item webpage loading devices based on UIWebView component of claim 7 to 10, feature exists In described device further includes cache information display module, for obtaining the residual capacity of the caching, by described UIWebView component shows the residual capacity.
CN201310516807.6A 2013-10-28 2013-10-28 Webpage loading method and device based on UIWebView component Active CN104572777B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201310516807.6A CN104572777B (en) 2013-10-28 2013-10-28 Webpage loading method and device based on UIWebView component
PCT/CN2014/088716 WO2015062416A1 (en) 2013-10-28 2014-10-16 Method and device for loading webpages based onuiwebview components

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310516807.6A CN104572777B (en) 2013-10-28 2013-10-28 Webpage loading method and device based on UIWebView component

Publications (2)

Publication Number Publication Date
CN104572777A CN104572777A (en) 2015-04-29
CN104572777B true CN104572777B (en) 2019-05-14

Family

ID=53003319

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310516807.6A Active CN104572777B (en) 2013-10-28 2013-10-28 Webpage loading method and device based on UIWebView component

Country Status (2)

Country Link
CN (1) CN104572777B (en)
WO (1) WO2015062416A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881452B (en) * 2015-05-18 2020-05-29 百度在线网络技术(北京)有限公司 Resource address sniffing method, device and system
CN104954894B (en) * 2015-06-26 2019-03-26 网宿科技股份有限公司 A kind of video flow bootstrap technique, device and a kind of electronic equipment
CN106469044B (en) * 2015-08-14 2021-02-02 腾讯科技(深圳)有限公司 Method and device for realizing page jump
CN106776567B (en) * 2016-12-22 2020-05-15 金蝶软件(中国)有限公司 Internet big data analysis and extraction method and system
CN107729352B (en) * 2017-08-30 2020-07-31 深圳壹账通智能科技有限公司 Page resource loading method and terminal equipment
CN109857473A (en) * 2017-11-29 2019-06-07 北京京东尚科信息技术有限公司 A kind of loading method and device of page data
CN110209967B (en) * 2019-04-17 2022-05-03 北京奇艺世纪科技有限公司 Page loading method and device, terminal equipment and computer readable medium
CN110347949A (en) * 2019-06-20 2019-10-18 中信百信银行股份有限公司 Webpage loading method, device, electronic equipment and computer readable storage medium
CN110417919B (en) * 2019-08-29 2021-10-29 网宿科技股份有限公司 Traffic hijacking method and device
CN110955856B (en) * 2019-10-14 2023-01-10 北京奇艺世纪科技有限公司 Webpage loading method and device, server and storage medium
CN112925573B (en) * 2019-11-20 2023-09-26 北京沃东天骏信息技术有限公司 Method, device, equipment and computer readable medium for loading web page

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101431525A (en) * 2007-11-06 2009-05-13 陈明杰 Acceleration method and system for network content loading, its server and terminal
CN103188293A (en) * 2011-12-28 2013-07-03 腾讯科技(深圳)有限公司 Method and system for allowing mobile terminal to access webpage
CN103246739A (en) * 2013-05-16 2013-08-14 百度在线网络技术(北京)有限公司 Web browsing control method of multiple Web Views and browser

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7685526B2 (en) * 2003-11-26 2010-03-23 Sap Aktiengesellschaft Providing navigation in a browser
JP2010140347A (en) * 2008-12-12 2010-06-24 Canon Inc Web server device, client device, control method therefor and program
CN102968252B (en) * 2012-11-05 2016-06-29 北京奇虎科技有限公司 The method and apparatus of page back/advance
CN102968253B (en) * 2012-11-05 2016-09-28 北京奇虎科技有限公司 browser control method and device
CN103366019B (en) * 2013-08-06 2016-09-28 飞天诚信科技股份有限公司 A kind of webpage hold-up interception method based on iOS device and equipment
CN104050253B (en) * 2014-06-12 2018-09-25 北京猎豹网络科技有限公司 A kind of web page display method and browser

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101431525A (en) * 2007-11-06 2009-05-13 陈明杰 Acceleration method and system for network content loading, its server and terminal
CN103188293A (en) * 2011-12-28 2013-07-03 腾讯科技(深圳)有限公司 Method and system for allowing mobile terminal to access webpage
CN103246739A (en) * 2013-05-16 2013-08-14 百度在线网络技术(北京)有限公司 Web browsing control method of multiple Web Views and browser

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"IOS学习之WebView的使用";Severus54;《百度文库》;20121020;正文第1页、第5-7页

Also Published As

Publication number Publication date
CN104572777A (en) 2015-04-29
WO2015062416A1 (en) 2015-05-07

Similar Documents

Publication Publication Date Title
CN104572777B (en) Webpage loading method and device based on UIWebView component
US8413044B2 (en) Method and system of retrieving Ajax web page content
CN102882991B (en) A kind of browser and carry out the method for domain name mapping
CN106528657A (en) Control method and device for browser skipping to application program
CN106294648B (en) Processing method and device for page access path
CN102843445B (en) A kind of browser and carry out the method for domain name mapping
CN105095280B (en) Browser caching method and device
US9292467B2 (en) Mobile resource accelerator
US20190222667A1 (en) Speculative prefetch of resources across page loads
CN108632219B (en) Website vulnerability detection method, detection server, system and storage medium
CN104750471A (en) WEB page performance detection and analysis plug-in and method based on browser
CN106126693A (en) The sending method of the related data of a kind of webpage and device
CN104615771B (en) A kind of method and device obtaining web data
CN103577427A (en) Browser kernel based web page crawling method and device and browser containing device
CN111177519B (en) Webpage content acquisition method, device, storage medium and equipment
CN110221871B (en) Webpage acquisition method and device, computer equipment and storage medium
CN112637361B (en) Page proxy method, device, electronic equipment and storage medium
CN107402938A (en) page display method, device and client device
CN106599270B (en) Network data capturing method and crawler
CN109829121A (en) A kind of method and apparatus clicking behavioral data and reporting
US9727643B2 (en) Managing loading of web pages
Shroff et al. Critical rendering path optimizations to reduce the web page loading time
US9465814B2 (en) Annotating search results with images
CN104731817B (en) A kind of webpage exhibiting method and device
CN102681996B (en) Pre-head method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant