CN101639774B - Encapsulation method of browser control part and device thereof - Google Patents

Encapsulation method of browser control part and device thereof Download PDF

Info

Publication number
CN101639774B
CN101639774B CN2009100906015A CN200910090601A CN101639774B CN 101639774 B CN101639774 B CN 101639774B CN 2009100906015 A CN2009100906015 A CN 2009100906015A CN 200910090601 A CN200910090601 A CN 200910090601A CN 101639774 B CN101639774 B CN 101639774B
Authority
CN
China
Prior art keywords
function
browser
java script
control part
incident
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
CN2009100906015A
Other languages
Chinese (zh)
Other versions
CN101639774A (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 CN2009100906015A priority Critical patent/CN101639774B/en
Publication of CN101639774A publication Critical patent/CN101639774A/en
Application granted granted Critical
Publication of CN101639774B publication Critical patent/CN101639774B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention provides an encapsulation method of a browser control part and a device thereof. The method comprises the following steps of: encapsulating a defined method event into the browser control part by spreading an application function interface of a JAVA script; when the browser calls the application function interface by the JAVA script, calling a corresponding function mapping device to distribute corresponding identification for the function of the defined method event by the browser control part; obtaining the function of the defined method event and the parameter of the function by the identification; and according to the function of the defined method event and the parameter of the function, calling the corresponding application function interface to execute the defined method event. By implementing the technical scheme, the invention can lead the browser control part and a customer end to be better integrated, and improves expansibility; and all the application program interfaces can be dynamically added, and the mapping relationship of the function identification is more flexible.

Description

A kind of method for packing of browser control part and device
Technical field
The present invention relates to network communication field, relate in particular to a kind of method for packing and device of browser control part.
Background technology
At present, a lot of occasions that are encapsulated in of browser control part have all obtained application, with the IE browser control part of Microsoft, for example in the MFC of Microsoft class libraries CHtmlview to the application such as encapsulation of the browser IE of Microsoft control.We describe with the invoked procedure that JAVA script JavaScript calls the window.external.api_myfunction function, and the linear function invoked procedure of prior art scheme is following:
Step 1:JavaScript call function interface window.external.api_myfunction;
Step 2:IE browser control part calls the IDispatch::GetIDsOfNames method and obtains the corresponding id of function name, if do not realize this function name mapping relations, browser control part will not handled this method;
Step 3:IE browser control part calls the IDispatch::Invoke method, obtains the parameter information in sign id and the function;
Step 4: processor calls corresponding treatment scheme according to predefined sign.
Can know from above disclosed scheme, in the browser control part package application of prior art and the integration of client code not strong, the utilization of extendability is also very not enough; And existing techniques in realizing is the function identification and the mapping relations thereof of fixing, and all like this mapping relations are pre-set, can not add dynamically, and the memory sign is also just relatively difficult.
Summary of the invention
The embodiment of the invention provides a kind of method for packing and device of browser control part, can make better the integrating of browser control part and client, has improved extendability; All simultaneously application programming interfaces can add dynamically, and the mapping relations of function identification are also more flexible.
The embodiment of the invention provides a kind of method for packing of browser control part, and said method comprises:
Expansion through to the utility function interface of JAVA script is packaged in self-defining method incident in the browser control part;
When browser passed through JAVA script calls utility function interface, the function that it is said customizing method incident that said browser control part calls corresponding Function Mapping device distributed corresponding sign;
Obtain the function and this function parameters of said customizing method incident through said sign;
Function and this function parameters according to said customizing method incident call the application corresponding function interface and carry out this self-defining method incident.
Said be packaged in self-defining method incident in the browser control part after, said method also comprises:
Create encapsulation manager, preserve the function and this function parameters of the customizing method incident of encapsulation through said encapsulation manager.
After said establishment encapsulation manager, said method also comprises:
The user adds self-defining external application interface through in said encapsulation manager, creating the function of customizing method incident.
After said establishment encapsulation manager, said method also comprises:
Between different browsers, realize calling each other of JAVA script function, be specially:
First browser obtains the sign and the parameter information of the JAVA script function in second browser;
In said encapsulation manager, find the JAVA script function of corresponding second browser according to said sign and parameter information;
Call the JAVA script function that is found, realize the calling each other of JAVA script function between the different browsers.
Said browser is the browser IE of Microsoft.
The embodiment of the invention also provides a kind of packaging system of browser control part, and said device comprises:
The browser encapsulation unit is used for through the expansion to the utility function interface of JAVA script self-defining method incident being packaged in the browser control part;
The identification distribution unit is used at browser when the JAVA script calls utility function interface, and the function that to call corresponding Function Mapping device be said customizing method incident distributes corresponding sign;
Parameter acquiring unit is used for the function and this function parameters that obtain said customizing method incident through the sign that said identification distribution unit is distributed;
Carry out processing unit, the function and this function parameters of the customizing method incident that is used for obtaining according to said parameter acquiring unit call the application corresponding function interface and carry out this self-defining method incident.
Said device also comprises:
The encapsulation manager unit is used to preserve the function and this function parameters of the customizing method incident of encapsulation and the utility function interface that provides browser-cross to call.
Said device also comprises:
The browser-cross call unit is used between different browsers, realizing calling each other of JAVA script function.
Said device is integrated to be arranged in the client.
Can find out by the above-mentioned technical scheme that provides, at first pass through expansion, self-defining method incident is packaged in the browser control part the utility function interface of JAVA script; When said browser passed through JAVA script calls utility function interface, the function that it is said customizing method incident that browser control part calls corresponding Function Mapping device distributed corresponding sign; Obtain the function and this function parameters of this customizing method incident through said sign; Function and this function parameters according to this customizing method incident call the application corresponding function interface and carry out this self-defining method incident.Through the enforcement of above technical scheme, just can make better the integrating of browser control part and client, improved extendability; All simultaneously application programming interfaces can add dynamically, and the mapping relations of function identification are also more flexible.
Description of drawings
The schematic flow sheet of the browser control part method for packing that Fig. 1 is provided for the embodiment of the invention 1;
The structural representation of the browser control part packaging system that Fig. 2 is provided for the embodiment of the invention 2.
Embodiment
The embodiment of the invention provides a kind of method for packing and device of browser control part; Through expansion to JAVA script function interface; User-defined method incident is packaged in the browser control part, thereby makes browser control part and better the integrating of client, improved extendability; All simultaneously application programming interfaces can add dynamically, and the mapping relations of function identification are also more flexible.
Embodiment 1:
For better describing embodiment of the present invention, combine accompanying drawing that specific embodiment of the present invention is described at present, be illustrated in figure 1 as the schematic flow sheet of the browser control part method for packing that the embodiment of the invention 1 provided, said method comprises:
Step 11: the utility function interface of expansion JAVA script, encapsulation browser control part.
In this step, at first, can self-defining method incident be packaged in the browser control part through expansion to JAVA script applications function interface.Specifically when encapsulation, can in JAVA script applications function interface, increase the parameter and the function representation of corresponding event, should self-defining method incident be encapsulated in the browser control part.
In concrete implementation procedure, described browser can be the browser IE of Microsoft, also can be the browser of other types, for example red fox etc.
Step 12: when browser calling application function interface, the function that is this customizing method incident through corresponding Function Mapping device distributes corresponding sign.
In this step, when Web page loading WEB, browser is through JAVA script calls utility function interface, and the function that it is said customizing method incident that browser control part calls corresponding Function Mapping device distributes corresponding sign.
In concrete implementation procedure,, then can distribute a untapped sign ID, and preserve mapping relations for the function of this customizing method incident if receive the mapping request of the function name of said customizing method incident first; If not request first, then can from the mapping relations that had, extract the corresponding identification ID of preservation.
Step 13: the function and this function parameters that obtain said customizing method incident through sign.
In this step, can from corresponding management database, obtain the function and this function parameters of said customizing method incident according to the sign of this acquisition by browser control part.
In concrete implementation procedure; Can create encapsulation manager; Utilize this encapsulation manager to preserve the function and this function parameters of the customizing method incident of encapsulation, browser control part just can obtain needed function and this function parameters according to the sign that obtains from this encapsulation manager like this.
For instance, says, create wrapper, and the programming instance of management wrapper is following with concrete programming instance:
Class IBrowserManager (browser administration)
{public:
// creating the browser package interface of specifying name pszName, pBrowser will point to this interface
virtual?BOOL?Create(LPCTSTR?pszName,IBrowser**pBrowser)=0;
// obtain the browser interface of specifying name
virtual?IBrowser*GetBrowser(LPCTSTR?pszName)=0;
The browser interface of name is specified in // destruction
virtual?BOOL?DestroyeBrowser(LPCTSTR?pszName)=0;
// all browsers are called the Javascript function that name is name
virtual?void?BrowserInvokeProc(LPCTSTR?name,DISPPARAMS&di?spparams,
VARIANT?&varResult,UINT?&uArgErr)=0;}
In addition, the user can also add self-defining external application interface through in above-mentioned encapsulation manager, creating the function of customizing method incident.
For instance, suppose that the user calls encapsulation manager and created function aSuperBrowser, then specifically comprises:
Step 1; Realization event interface IBrowserEvent, and in the OnBrowserInvokeProc incident, realize self-defining application programming interfaces, such as realize JavaScript function window.external.api_functionexample as if needs; Just can be through the processing procedure of following false code; In the above-mentioned JavaScript function, window.external is the intrinsic field of function, and the api_functionexample of back is the part of the self-defined expansion of the embodiment of the invention:
{ if title name equates with api_functionexample, then gets into processing procedure }
Step 2 is called the above-mentioned event interface IBrowserEvent of aSuperBrowser.AddBrowerEventHandler method registration.
After carrying out above-mentioned operation, just can realize adding self-defining external application interface.
Step 14:, call the application corresponding function interface and come the manner of execution incident according to function and this function parameters of this customizing method incident.
In this step; In the above-mentioned operation steps of process; Obtain after sign title and this function parameters of function of this customizing method incident; Just can call the application corresponding function interface and carry out this self-defining method incident according to the function and this function parameters of this customizing method incident.
For instance, be encapsulated as example with the control of the browser IE of Microsoft, realize the encapsulation of customizing method incident through the expansion to JAVA script JavaScript utility function interface, detailed process is following:
Class IBrowserEvent (browser event, self-defining title)
{public:
virtual?void?OnBrowserInvokeProc(IBrowser*pBrowser,DISPID
dispidMember,LPCTSTR?name,DISPPARAMS*pdispparams,VARIANT*pvarResult)=
0; The method of // encapsulation IE control
virtual?void?OnBrowserShowContextMenu(IBrowser*pBrowser,DWORD?dwID,
POINT*ppt,IUnknown*pcmdtReserved,IDispatch*pdispReserved,HRESULT*phr)=0;
The method of // encapsulation IE control
virtual?void?OnBrowserGetHostInfo(IBrowser*pBrowser,DOCHOSTUIINFO
* pInfo, HRESULT*phr)=0; The method of // encapsulation ie control };
Through the enforcement of above technical scheme, just can make better the integrating of browser control part and client, improved extendability; All simultaneously application programming interfaces can add dynamically, and the mapping relations of function identification are also more flexible.
In addition, in concrete implementation procedure, can also between different browsers, realize calling each other of JAVA script function, specifically, first browser obtains the sign and the parameter information of the JAVA script function in second browser; In said encapsulation manager, find the JAVA script function of corresponding second browser then according to said sign and parameter information; Call the JAVA script function that is found again, thereby realize the calling each other of JAVA script function between the different browsers.
For instance, browser BrowserA call browser BrowserB JavaScript function addition function sum (x, y), and get the processing procedure of getting the result of calculating 3+2:
Step 1, call method among the BrowserA
result=window.external.api_remotecall(BrowserB,sum,3,2)
Step 2; System gets into the flow process of calling window.external.api_remotecall; The parameter s trName of this flow process through in step 1, being obtained finds BrowserB in encapsulation manager, and then the method for calling BrowserB.BrowserInvokeProc is returned after accomplishing.
Through above process, just realized the interface interchange between browser-cross.
In addition, in the specific embodiment of the invention, can be the browser IE of Microsoft to the encapsulation of browser control part, also can be the browser of other types, red fox etc. for example; And the platform of browser encapsulation also can adopt other programming language to describe, and not necessarily adopts C Plus Plus.
Embodiment 2:
The embodiment of the invention 2 provides a kind of packaging system of browser control part; Be illustrated in figure 2 as the structural representation of 2 generators of present embodiment; Said device comprises browser encapsulation unit, identification distribution unit, parameter acquiring unit and execution processing unit, wherein:
Said browser encapsulation unit is used for through the expansion to the utility function interface of JAVA script self-defining method incident being packaged in the browser control part.
Said identification distribution unit is used at browser when the JAVA script calls utility function interface, and the function that to call corresponding Function Mapping device be said customizing method incident distributes corresponding sign.
Said parameter acquiring unit is used for obtaining through the sign that said identification distribution unit is distributed the function and this function parameters of said customizing method incident.
The function of the customizing method incident that said execution processing unit is used for obtaining according to said parameter acquiring unit and this function parameters call the application corresponding function interface and carry out this self-defining method incident.
In addition, also can comprise the encapsulation manager unit in the above-described device, this encapsulation manager unit is used to preserve the function and this function parameters of the customizing method incident of encapsulation, and the utility function interface that provides browser-cross to call.
In addition, also can comprise the browser-cross call unit in the above-described device, this browser-cross call unit is used between different browsers, realizing calling each other of JAVA script function.The mode of specifically calling is seen described in the above method embodiment 1.
Above-described device can integratedly be arranged in the client; Also can be arranged to independent functional entity and client maintains the connection.
It should be noted that among the said apparatus embodiment that each included unit is just divided according to function logic, but is not limited to above-mentioned division, as long as can realize function corresponding; In addition, the concrete title of each functional unit also just for the ease of mutual differentiation, is not limited to protection scope of the present invention.
In addition; One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Corresponding program can be stored in a kind of computer-readable recording medium; The above-mentioned storage medium of mentioning can be a ROM (read-only memory), disk or CD etc.
In sum, the embodiment of the invention can make browser control part and better the integrating of client, has improved extendability; All simultaneously application programming interfaces can add dynamically, and the mapping relations of function identification are also more flexible.
The above; Be merely the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, any technician who is familiar with the present technique field is in the technical scope that the present invention discloses; The variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claims.

Claims (5)

1. the method for packing of a browser control part is characterized in that, said method comprises:
Expansion through to the utility function interface of JAVA script is packaged in self-defining method incident in the browser control part;
When browser passed through JAVA script calls utility function interface, the function that it is said customizing method incident that said browser control part calls corresponding Function Mapping device distributed corresponding sign;
Obtain the function and this function parameters of said customizing method incident through said sign;
Function and this function parameters according to said customizing method incident call the application corresponding function interface and carry out this self-defining method incident;
Wherein, said be packaged in self-defining method incident in the browser control part after, said method also comprises:
Create encapsulation manager, preserve the function and this function parameters of the customizing method incident of encapsulation through said encapsulation manager, and after said establishment encapsulation manager, said method comprise also:
Between different browsers, realize calling each other of JAVA script function, be specially:
First browser obtains the sign and the parameter information of the JAVA script function in second browser;
In said encapsulation manager, find the JAVA script function of corresponding second browser according to said sign and parameter information;
Call the JAVA script function that is found, realize the calling each other of JAVA script function between the different browsers.
2. the method for claim 1 is characterized in that, after said establishment encapsulation manager, said method also comprises:
The user adds self-defining external application interface through in said encapsulation manager, creating the function of customizing method incident.
3. according to claim 1 or claim 2 method is characterized in that,
Said browser is the browser IE of Microsoft.
4. the packaging system of a browser control part is characterized in that, said device comprises:
The browser encapsulation unit is used for through the expansion to the utility function interface of JAVA script self-defining method incident being packaged in the browser control part;
The identification distribution unit is used at browser when the JAVA script calls utility function interface, and the function that to call corresponding Function Mapping device be said customizing method incident distributes corresponding sign;
Parameter acquiring unit is used for the function and this function parameters that obtain said customizing method incident through the sign that said identification distribution unit is distributed;
Carry out processing unit, the function and this function parameters of the customizing method incident that is used for obtaining according to said parameter acquiring unit call the application corresponding function interface and carry out this self-defining method incident;
Wherein, said device also comprises:
The encapsulation manager unit is used to preserve the function and this function parameters of the customizing method incident of encapsulation and the utility function interface that provides browser-cross to call;
Said device also comprises:
The browser-cross call unit is used between different browsers, realizing calling each other of JAVA script function that specifically be embodied as: first browser obtains the sign and the parameter information of the JAVA script function in second browser; In said encapsulation manager, find the JAVA script function of corresponding second browser according to said sign and parameter information; Call the JAVA script function that is found, realize the calling each other of JAVA script function between the different browsers.
5. device as claimed in claim 4 is characterized in that, said device is integrated to be arranged in the client.
CN2009100906015A 2009-08-31 2009-08-31 Encapsulation method of browser control part and device thereof Active CN101639774B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100906015A CN101639774B (en) 2009-08-31 2009-08-31 Encapsulation method of browser control part and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100906015A CN101639774B (en) 2009-08-31 2009-08-31 Encapsulation method of browser control part and device thereof

Publications (2)

Publication Number Publication Date
CN101639774A CN101639774A (en) 2010-02-03
CN101639774B true CN101639774B (en) 2012-06-27

Family

ID=41614769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100906015A Active CN101639774B (en) 2009-08-31 2009-08-31 Encapsulation method of browser control part and device thereof

Country Status (1)

Country Link
CN (1) CN101639774B (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102830959B (en) * 2011-06-16 2015-09-09 中国科学院声学研究所 A kind of built-in browser interface dynamic expansion method and system
CN103177003A (en) * 2011-12-21 2013-06-26 腾讯科技(深圳)有限公司 Browser instruction processing method and browser
CN103246660A (en) * 2012-02-07 2013-08-14 腾讯科技(深圳)有限公司 Method and device for achieving extended functions of browser
CN103543991B (en) * 2012-07-09 2018-06-08 百度在线网络技术(北京)有限公司 A kind of method and browser for extending browser function
CN102831212B (en) * 2012-08-14 2015-08-26 优视科技有限公司 The composition method of page display and device
CN103593370B (en) * 2012-08-16 2017-08-22 腾讯科技(深圳)有限公司 The method and browser of expanded application are realized in a browser
CN102929599B (en) * 2012-09-26 2015-12-02 广州市动景计算机科技有限公司 The amending method at browser of mobile terminal interface and device, mobile terminal
CN102929656B (en) * 2012-09-28 2015-11-25 北京奇虎科技有限公司 Use method and the client of ActiveX plug-in in browser
CN103064663B (en) * 2012-11-19 2016-03-09 北京百度网讯科技有限公司 The generation of browser plug-in, issue, loading and update method and system
CN103034503B (en) * 2012-12-25 2016-07-06 北京奇虎科技有限公司 A kind of script execution, system and browser
CN103019867B (en) * 2012-12-25 2016-06-01 北京奇虎科技有限公司 Script execution between process, system and browser
CN104298493A (en) * 2013-07-19 2015-01-21 深圳市同洲电子股份有限公司 Local extension method and system for Javascript
CN104346228B (en) * 2013-07-26 2017-12-05 华为终端有限公司 The method and terminal of sharing application program
WO2015014189A1 (en) * 2013-08-02 2015-02-05 优视科技有限公司 Method and device for accessing website
CN103838615B (en) * 2014-02-28 2017-05-17 广州华多网络科技有限公司 Strategy execution method, strategy execution device and strategy execution system
CN105117233B (en) * 2015-09-14 2019-05-28 百度在线网络技术(北京)有限公司 API Calls method and device
CN106020994A (en) * 2016-05-06 2016-10-12 福建创意嘉和软件有限公司 A script and interface interworking method and device
CN108897550B (en) * 2018-06-08 2021-07-30 江苏中威科技软件系统有限公司 System and method for realizing program deployment, access and upgrade through packaging browser
CN110399580B (en) * 2019-07-22 2023-03-28 腾讯科技(深圳)有限公司 Method and device for displaying target style in browser

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6188401B1 (en) * 1998-03-25 2001-02-13 Microsoft Corporation Script-based user interface implementation defining components using a text markup language
CN101132413A (en) * 2007-09-18 2008-02-27 中兴通讯股份有限公司 ActiveX component multiplexing method based on Web application
CN101146119A (en) * 2007-10-25 2008-03-19 珠海金山软件股份有限公司 A device and method for browser-cross self-adapted call of local function

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6188401B1 (en) * 1998-03-25 2001-02-13 Microsoft Corporation Script-based user interface implementation defining components using a text markup language
CN101132413A (en) * 2007-09-18 2008-02-27 中兴通讯股份有限公司 ActiveX component multiplexing method based on Web application
CN101146119A (en) * 2007-10-25 2008-03-19 珠海金山软件股份有限公司 A device and method for browser-cross self-adapted call of local function

Also Published As

Publication number Publication date
CN101639774A (en) 2010-02-03

Similar Documents

Publication Publication Date Title
CN101639774B (en) Encapsulation method of browser control part and device thereof
US6578191B1 (en) Method and apparatus for dynamic generation of adapters
KR101833341B1 (en) Object oriented marshaling scheme for calls to a secure region
US9569181B2 (en) System and method for supporting an object oriented scripting tool
US20140075422A1 (en) Method for dynamically transforming the bytecode of java virtual machine bootstrap classes
WO2005085995A1 (en) Method, system, and program for invoking methods between computer languages
WO2008061457A1 (en) A method for packaging the uoml to applicaions programming interface
JP2001527234A (en) Call mechanism for static and dynamic linked functions in an object-oriented controller using a heterogeneous development tool set
CN100590597C (en) Local resource access method and device
CN103186386B (en) Using loading method and system
CN101692206A (en) Method for adding dynamic parameters to static callback function and related realization
CN104503768A (en) Call method and device for application programming interface (API)
CN104021024A (en) Loading method and system of tabletop system function screen
WO2003073266A1 (en) System and method for object activation
WO2004008312A1 (en) Application modification system and method
CN101719069A (en) Method and device of Web servitization of Java system
US8656382B2 (en) Preventing an incompatible class exception caused by incompatible class loaders
CN104407864A (en) Encapsulation method and system for conducting multi-case calling through JNI (Java Native Interface)-layer algorithm
JP5165234B2 (en) Support for method references in Java language
Bissyandé et al. Bridging the gap between legacy services and web services
CN103473116A (en) Remote call method and device for data with large data volume
CN101651633B (en) Terminal, system and method for supporting mobile internet application
CN110874321B (en) Remote calling method, calling encapsulation engine and remote proxy engine of test interface
CN112835654B (en) Method, device and processor for calling functions in dynamic link library
CN103577177A (en) Method and equipment for invoking graphics libraries

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