CN102915318B - Method and device for positioning and searching information in browser - Google Patents

Method and device for positioning and searching information in browser Download PDF

Info

Publication number
CN102915318B
CN102915318B CN201210060139.6A CN201210060139A CN102915318B CN 102915318 B CN102915318 B CN 102915318B CN 201210060139 A CN201210060139 A CN 201210060139A CN 102915318 B CN102915318 B CN 102915318B
Authority
CN
China
Prior art keywords
script
browser
search
page
node
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
CN201210060139.6A
Other languages
Chinese (zh)
Other versions
CN102915318A (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.)
Zhuhai Baohaowan Technology Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Conew Network Technology Beijing Co Ltd
Shell Internet Beijing Security 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 Beijing Kingsoft Internet Security Software Co Ltd, Conew Network Technology Beijing Co Ltd, Shell Internet Beijing Security Technology Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201210060139.6A priority Critical patent/CN102915318B/en
Publication of CN102915318A publication Critical patent/CN102915318A/en
Application granted granted Critical
Publication of CN102915318B publication Critical patent/CN102915318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention provides a method and a device for positioning and searching information in a browser, wherein the method comprises the following steps: acquiring a webpage script requested by a browser; rendering a webpage into a page window of the browser according to the webpage script; obtaining input keywords to be searched in the page window; injecting a search script into the webpage script; and obtaining the webpage elements matched with the keywords according to the search script. The scheme of the invention can improve the searching efficiency of the webpage elements.

Description

The method and apparatus of positioning searching information in a kind of browser
Technical field
The present invention relates to the data processing technique of browser, refer to the method and apparatus of positioning searching information in a kind of browser especially.
Background technology
The principle of work of browser is as follows: browser sends a HTTP (Hyper text transfer protocol to Web server, HTML (Hypertext Markup Language)) request, Web server is according to this HTTP request, by HTML (the Hyper text markup language of corresponding web page, HTML (Hypertext Markup Language)) script returns to the render engine of described browser, and each element of this webpage is played up on the display interface of client according to the html script of this webpage by render engine.
In the page window of browser, during to search an information, as the menu bar of open any browser, when clicking " searching (at current page) " option, then search what eject the content that in frame, input will be searched, this content that will search can be the keyword that the arbitrary element on webpage is corresponding.
When classic method realizes searching in the page window of browser, that render engine is the process playing up the html script obtained from Web server, an element-tree can be produced, this element-tree comprises all elements of the corresponding webpage of this html script, as the news links in this webpage, picture element etc.; From this element-tree, found the element matched with above-mentioned keyword by this render engine, and mark in mode that is highlighted or other effect.
This implementation procedure, owing to needing to search in the element-tree of render engine, consumes resources is many, and search efficiency is low.
Summary of the invention
The technical problem to be solved in the present invention is to provide the method and apparatus of positioning searching information in a kind of browser, can improve the search efficiency of browser.
For solving the problems of the technologies described above, embodiments of the invention provide the method for positioning searching information in a kind of browser, comprising:
Obtain the page script that browser is asked;
According to described page script, webpage is played up in the page window of described browser;
In described page window, obtain the keyword that will search of input;
In described page script, inject and search script;
Search script according to described, obtain the web page element with described Keywords matching.
Wherein, in described page script, inject the step of searching script and comprise:
In described page script, the insertion script function provided by browser kernel, searches script described in injection.
Wherein, search script according to described, obtain comprising with the step of the web page element of described Keywords matching:
Search the browser object in script described in parsing, obtain the node tree of this browser object;
The node matched with described keyword is searched in described node tree;
The web page element that the described node that acquisition finds is corresponding.
Wherein, search the browser object in script described in parsing, the step obtaining the node tree of this browser object comprises:
The chained list that browser object in script is corresponding is searched, the node tree that the multiple nodes obtaining described browser object are formed described in parsing.
Wherein, obtain with the web page element of described Keywords matching after also comprise:
Search script according to described, play up according to the display effect arranged the described web page element found at the page window of described browser.
Embodiments of the invention also provide the device of positioning searching information in a kind of browser, comprising:
First obtains module, for obtaining the page script that browser is asked;
Rendering module, for according to described page script, plays up in the page window of described browser by webpage;
Second obtains module, in described page window, obtains the keyword that will search of input;
Script injection module, in described page script, injects and searches script;
Search module, search script for described in basis, obtain the web page element with described Keywords matching.
Wherein, described script injection module is specifically in described page script, and the insertion script function provided by browser kernel, searches script described in injection.
Wherein, search module described in comprise:
Parsing module, for searching the browser object in script described in resolving, obtains the node tree of this browser object;
Search submodule, for searching the node matched with described keyword in described node tree;
Obtain submodule, for obtaining web page element corresponding to the described node that finds.
Wherein, described parsing module is specifically for searching chained list corresponding to browser object in script described in resolving, the node tree that the multiple nodes obtaining described browser object are formed.
Wherein, described rendering module also searches script for described in basis, plays up the described web page element found at the page window of described browser according to the display effect arranged.
The beneficial effect of technique scheme of the present invention is as follows:
In such scheme, by downloading in local described page script, injecting and searching script; Search script according to described, obtain the web page element with described Keywords matching, thus avoid and search in render engine, namely search in webpage, effectively improve search efficiency.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the method for positioning searching information in embodiments of the invention browser;
Fig. 2 is another schematic flow sheet of the method for positioning searching information in embodiments of the invention browser;
Fig. 3 is the structural representation of the device of positioning searching information in embodiments of the invention browser.
Embodiment
For making the technical problem to be solved in the present invention, technical scheme and advantage clearly, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
As shown in Figure 1, embodiments of the invention provide the method for positioning searching information in a kind of browser, comprising:
Step 11, obtains the page script that browser is asked;
Step 12, according to described page script, plays up in the page window of described browser by webpage;
Step 13, in described page window, obtains the keyword that will search of input;
Step 14, in described page script, injects and searches script;
Step 15, searches script according to described, obtains the web page element with described Keywords matching.
In this embodiment of the present invention, by downloading in local described page script, injecting and searching script; Search script according to described, obtain the web page element with described Keywords matching, thus avoid and search in render engine, namely search in webpage, effectively improve search efficiency.
Preferably, in the above-described embodiments, in described page script, inject the step of searching script and comprise:
In described page script, the insertion script function provided by browser kernel, searches script described in injection.Particularly, the interface function of the insertion script that can be provided by browser kernel, searches script described in injection; Certainly, in page script, inject the method for searching script and be not limited to the mode that the present embodiment provides, self-defining mode can also be comprised and inject.
In of the present invention in another embodiment, comprise on the basis of above-mentioned steps 11-15, search script according to described, obtain comprising with the step of the web page element of described Keywords matching:
Search the browser object in script described in parsing, obtain the node tree of this browser object; Particularly, described in parsing, search the chained list that browser object in script is corresponding, the node tree that the multiple nodes obtaining described browser object are formed;
The node matched with described keyword is searched in described node tree;
The web page element that the described node that acquisition finds is corresponding.
Wherein, this searches in script the data structure with a DOM, this DOM is a browser object, by the mode enumerated, can list each node of this DOM, this node is as being arbitrary web page element that page script comprises, as passage in webpage, a pictures, animation etc., wherein node here also may comprise node, and these nodes can be enumerated with the form of tree or chained list; Certainly, also according to a transformation rule, chained list can be converted to tree construction or convert tree construction to chained list, not limiting in the node of this browser object concrete manifestation form the present embodiment in enumeration process.
When obtaining web page element corresponding to the described node that finds, as being all nodes in the described chained list of traversal or node tree, and the present node that travels through of judgement whether with described Keywords matching.
As shown in Figure 2, in another embodiment of the invention, on the basis comprising above-mentioned steps 11-15, can also comprise after step 15:
Step 16, searches script according to described, plays up the described web page element found at the page window of described browser according to the display effect arranged; Particularly, if find the node with Keywords matching, then calls application interface function, current display position from the node of Keywords matching and display styles are set to described chained list in or other node in node tree different; Wherein, comprising: be the explicit identification etc. that runic shows, the explicit identification of different colours, the explicit identification of amplification or font are floated by the curriculum offering corresponding with the node of described Keywords matching.
The above embodiment of the present invention by injecting a segment search script in the page script played up, by this search define in script search logic, the web page element corresponding with the keyword inputted is searched in web page windows, such one side, do not need to utilize render engine, the resource expended when making browser perform locating function is few, and search efficiency correspondingly improves; On the other hand, be no longer by render engine from Web browser downloading web pages script, play up, while search; But slightly make an amendment (namely inject and search script) downloading to local page script in this locality, just can be implemented in this locality and process, just can realize the locating function of web page element, thus improve search efficiency.
As shown in Figure 3, embodiments of the invention also provide the device of positioning searching information in browser, comprising:
First obtains module 31, for obtaining the page script that browser is asked;
Rendering module 32, for according to described page script, plays up in the page window of described browser by webpage;
Second obtains module 33, in described page window, obtains the keyword that will search of input;
Script injection module 34, in described page script, injects and searches script;
Search module 35, search script for described in basis, obtain the web page element with described Keywords matching.
This device embodiment of the present invention, equally by described page script, is injected and is searched script; Search script according to described, obtain the web page element with described Keywords matching, thus avoid and search in render engine, effectively improve search efficiency.
Wherein, described script injection module 34 is specifically in described page script, and the insertion script function provided by browser kernel, searches script described in injection.
Particularly, the interface function of the insertion script that can be provided by browser kernel, searches script described in injection; Certainly, in page script, inject the method for searching script and be not limited to the mode that the present embodiment provides, self-defining mode can also be comprised and inject.
Preferably, search module 35 described in comprise:
Parsing module, for searching the browser object in script described in resolving, obtains the node tree of this browser object; Particularly, described in parsing, search the chained list that browser object in script is corresponding, the node tree that the multiple nodes obtaining described browser object are formed;
Search submodule, for searching the node matched with described keyword in described node tree;
Obtain submodule, for obtaining web page element corresponding to the described node that finds.
Wherein, this searches in script the data structure with a DOM, this DOM is a browser object, by the mode enumerated, can list each node of this DOM, this node is as being arbitrary web page element that page script comprises, as passage in webpage, a pictures, animation etc., wherein node here also may comprise node, and these nodes can be enumerated with the form of tree or chained list; Certainly, also according to a transformation rule, chained list can be converted to tree construction or convert tree construction to chained list, not limiting in the node of this browser object concrete manifestation form the present embodiment in enumeration process.
When obtaining web page element corresponding to the described node that finds, as being all nodes in the described chained list of traversal or node tree, and the present node that travels through of judgement whether with described Keywords matching.
Preferably, described rendering module also searches script for described in basis, plays up the described web page element found at the page window of described browser according to the display effect arranged.
Particularly, if find the node with Keywords matching, then calls application interface function, current display position from the node of Keywords matching and display styles are set to described chained list in or other node in node tree different; Wherein, comprising: be the explicit identification etc. that runic shows, the explicit identification of different colours, the explicit identification of amplification or font are floated by the curriculum offering corresponding with the node of described Keywords matching.
The above embodiment of the present invention by injecting a segment search script in the page script played up, by this search define in script search logic, the web page element corresponding with the keyword inputted is searched in web page windows, such one side, do not need to utilize render engine, the resource expended when making browser perform locating function is few, and search efficiency correspondingly improves; On the other hand, no longer while from Web browser downloading web pages script, while play up, while search, but slightly make an amendment (namely inject and search script) downloading to local page script in this locality, just can be implemented in this locality to process, just can realize the locating function of web page element, thus improve search efficiency.
The above is the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the prerequisite not departing from principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (10)

1. the method for positioning searching information in browser, is characterized in that, comprising:
Obtain the page script that browser is asked;
According to described page script, webpage is played up in the page window of described browser;
In described page window, obtain the keyword that will search of input;
In the described page script downloading to described browser this locality, inject and search script;
The web page element that logic obtains with described Keywords matching in described webpage is searched according to what search script described in being injected in described page script.
2. the method for positioning searching information in browser according to claim 1, is characterized in that, in described page script, injects the step of searching script and comprises:
In described page script, the insertion script function provided by browser kernel, searches script described in injection.
3. the method for positioning searching information in browser according to claim 1, is characterized in that, search script according to described, obtain comprising with the step of the web page element of described Keywords matching:
Search the browser object in script described in parsing, obtain the node tree of this browser object;
The node matched with described keyword is searched in described node tree;
The web page element that the described node that acquisition finds is corresponding.
4. the method for positioning searching information in browser according to claim 3, it is characterized in that, search the browser object in script described in parsing, the step obtaining the node tree of this browser object comprises:
The chained list that browser object in script is corresponding is searched, the node tree that the multiple nodes obtaining described browser object are formed described in parsing.
5. the method for positioning searching information in browser according to claim 4, is characterized in that, obtain with the web page element of described Keywords matching after also comprise:
Search script according to described, play up according to the display effect arranged the described web page element found at the page window of described browser.
6. the device of positioning searching information in browser, is characterized in that, comprising:
First obtains module, for obtaining the page script that browser is asked;
Rendering module, for according to described page script, plays up in the page window of described browser by webpage;
Second obtains module, in described page window, obtains the keyword that will search of input;
Script injection module, in the described page script downloading to described browser this locality, injects and searches script;
Search module, for searching according to what search script described in being injected in described page script the web page element that logic obtains with described Keywords matching in described webpage.
7. the device of positioning searching information in browser according to claim 6, it is characterized in that, described script injection module is specifically in described page script, and the insertion script function provided by browser kernel, searches script described in injection.
8. the device of positioning searching information in browser according to claim 6, is characterized in that, described in search module and comprise:
Parsing module, for searching the browser object in script described in resolving, obtains the node tree of this browser object;
Search submodule, for searching the node matched with described keyword in described node tree;
Obtain submodule, for obtaining web page element corresponding to the described node that finds.
9. the device of positioning searching information in browser according to claim 8, it is characterized in that, described parsing module is specifically for searching chained list corresponding to browser object in script described in resolving, the node tree that the multiple nodes obtaining described browser object are formed.
10. the device of positioning searching information in browser according to claim 9, it is characterized in that, described rendering module also searches script for described in basis, plays up the described web page element found at the page window of described browser according to the display effect arranged.
CN201210060139.6A 2012-03-08 2012-03-08 Method and device for positioning and searching information in browser Active CN102915318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210060139.6A CN102915318B (en) 2012-03-08 2012-03-08 Method and device for positioning and searching information in browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210060139.6A CN102915318B (en) 2012-03-08 2012-03-08 Method and device for positioning and searching information in browser

Publications (2)

Publication Number Publication Date
CN102915318A CN102915318A (en) 2013-02-06
CN102915318B true CN102915318B (en) 2015-06-17

Family

ID=47613689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210060139.6A Active CN102915318B (en) 2012-03-08 2012-03-08 Method and device for positioning and searching information in browser

Country Status (1)

Country Link
CN (1) CN102915318B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866483B (en) * 2014-02-21 2020-02-07 腾讯科技(深圳)有限公司 Information retrieval method and device
CN104536974B (en) * 2014-12-03 2018-03-02 北京奇虎科技有限公司 The method and browser client of information are searched in a browser
CN104915451A (en) * 2015-06-30 2015-09-16 北京奇虎科技有限公司 A method for fast locating search query term in browser and browser
CN106407229A (en) * 2015-08-03 2017-02-15 天脉聚源(北京)科技有限公司 Webpage keyword matching method and system
CN106777173A (en) * 2016-12-21 2017-05-31 广州阿里巴巴文学信息技术有限公司 Information flow methods of exhibiting, system and user terminal
CN108628899A (en) * 2017-03-23 2018-10-09 广州康昕瑞基因健康科技有限公司 Gene mutation database index method and system
CN107193450B (en) * 2017-05-25 2020-10-09 北京三快在线科技有限公司 Page element selection method and device
CN108416009A (en) * 2018-03-01 2018-08-17 广东欧珀移动通信有限公司 Text searching method, device, storage medium and the mobile terminal of mobile terminal
CN112363784A (en) * 2020-10-26 2021-02-12 深圳市明源云科技有限公司 Method and device for displaying window in application program

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808439A (en) * 2006-02-21 2006-07-26 西安迪戈科技有限责任公司 Method of adding searchable deep labels in web pages in conjunction with browser plug-ins and scripts
CN1808437A (en) * 2006-02-17 2006-07-26 北京金山软件有限公司 Instant webpage key word search method
CN101408879A (en) * 2008-11-19 2009-04-15 张琼 Method and system for searching product based on search engine
CN101621862A (en) * 2009-08-11 2010-01-06 中兴通讯股份有限公司 Method and device for positioning effective information rapidly for mobile phone browser

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020111974A1 (en) * 2001-02-15 2002-08-15 International Business Machines Corporation Method and apparatus for early presentation of emphasized regions in a web page

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808437A (en) * 2006-02-17 2006-07-26 北京金山软件有限公司 Instant webpage key word search method
CN1808439A (en) * 2006-02-21 2006-07-26 西安迪戈科技有限责任公司 Method of adding searchable deep labels in web pages in conjunction with browser plug-ins and scripts
CN101408879A (en) * 2008-11-19 2009-04-15 张琼 Method and system for searching product based on search engine
CN101621862A (en) * 2009-08-11 2010-01-06 中兴通讯股份有限公司 Method and device for positioning effective information rapidly for mobile phone browser

Also Published As

Publication number Publication date
CN102915318A (en) 2013-02-06

Similar Documents

Publication Publication Date Title
CN102915318B (en) Method and device for positioning and searching information in browser
CN104021172B (en) Advertisement filter method and advertisement filter device
CN109033115B (en) Dynamic webpage crawler system
CN101471818B (en) Detection method and system for malevolence injection script web page
CN102789484B (en) A kind of Web information processing method and apparatus
CN103186670B (en) A kind of method and system of complete collection info web
CN104063401B (en) The method and apparatus that a kind of webpage pattern address merges
CN103873918B (en) Image processing method, device and terminal
CN102819561B (en) Picture display method and device based on webpage
CN101621862A (en) Method and device for positioning effective information rapidly for mobile phone browser
CN105095280A (en) Caching method and apparatus for browser
CN102402518A (en) Method and device for accessing webpage
CN103577171B (en) A kind of method and mobile terminal of display web page contents
CN101369272A (en) Auto-filling system and method for auto-filling registration or login information
CN107066576A (en) A kind of big data web crawlers paging system of selection and system
CN102646135A (en) Webpage collecting method, device and system
CN102262635A (en) Page crawler system and page crawler method
CN101446954A (en) Wide area network crawler system for a video website
CN103838862B (en) Video searching method, device and terminal
CN107016102A (en) A kind of big data web crawlers paging collocation method
CN102207967B (en) Method and system for automatically providing new browser plugin
CN106294885A (en) A kind of data collection towards isomery webpage and mask method
CN103902571A (en) Method and system for saving webpage complete content and corresponding client end and server
US20140156799A1 (en) Method and System for Extracting Post Contents From Forum Web Page
CN102508887A (en) System and method for resolving digital television interaction service markup language

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 100085 Beijing City, Haidian District Road 33, Jinshan building Xiaoying

Co-patentee after: CONEW NETWORK TECHNOLOGY (BEIJING) Co.,Ltd.

Patentee after: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.

Co-patentee after: Beijing Cheetah Mobile Technology Co.,Ltd.

Address before: 100085 Beijing City, Haidian District Road 33, Jinshan building Xiaoying

Co-patentee before: CONEW NETWORK TECHNOLOGY (BEIJING) Co.,Ltd.

Patentee before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.

Co-patentee before: SHELL INTERNET (BEIJING) SECURITY TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20181218

Address after: Room 105-53967, No. 6 Baohua Road, Hengqin New District, Zhuhai City, Guangdong Province

Patentee after: Zhuhai Leopard Fun Technology Co.,Ltd.

Address before: 100085 Jinshan Building, 33 Xiaoying West Road, Haidian District, Beijing

Co-patentee before: CONEW NETWORK TECHNOLOGY (BEIJING) Co.,Ltd.

Patentee before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.

Co-patentee before: Beijing Cheetah Mobile Technology Co.,Ltd.