CN103226474A - Method, device and system for interaction between webpage script and browser program - Google Patents

Method, device and system for interaction between webpage script and browser program Download PDF

Info

Publication number
CN103226474A
CN103226474A CN201310172308XA CN201310172308A CN103226474A CN 103226474 A CN103226474 A CN 103226474A CN 201310172308X A CN201310172308X A CN 201310172308XA CN 201310172308 A CN201310172308 A CN 201310172308A CN 103226474 A CN103226474 A CN 103226474A
Authority
CN
China
Prior art keywords
browser program
browser
call
interface
program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310172308XA
Other languages
Chinese (zh)
Other versions
CN103226474B (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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201310172308.XA priority Critical patent/CN103226474B/en
Publication of CN103226474A publication Critical patent/CN103226474A/en
Application granted granted Critical
Publication of CN103226474B publication Critical patent/CN103226474B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to the field of computer network and discloses a method, device and system for interaction between a webpage script and a browser program. The method comprises the following steps of: receiving a call request, sent by the webpage script and aiming at the browser program, through a preset uniform interface; determining an inner core type corresponding to the browser program and determining a call interface corresponding to the inner core type according to the inner core type; and calling the browser program through the call interface. By using the method, device and system provided by the invention, the problem of complicated operation caused by the fact that the inner core type needs to be determined when the browser program is called by the webpage script in the prior art is solved, and the beneficial effect that browsers with different inner core types can be called uniformly to simplify a call process is achieved.

Description

Exchange method between page script and the browser program, Apparatus and system
Technical field
The present invention relates to computer network field, be specifically related to exchange method, Apparatus and system between a kind of page script and the browser program.
Background technology
Script (script) is to use a kind of specific descriptive language, and the executable file according to certain form is write is called grand or autoexec again.Page script and study course script can be called temporarily and be carried out usually by application program, and the script of mentioning in the present invention mainly is meant page script.Because page script not only can reduce the scale of webpage and improve the surfing of webpage, and can enrich the performance of webpage, as animation, sound etc., therefore, all kinds of page scripts are widely used in the webpage design at present.
For example, the function that can call Outlook Express or this class mail software of Foxmail during by the E-mail address on the browser webpage clicking automatically as the user realizes by page script.Particularly, in order to realize said process, usually on browser, also be equipped with and be specifically designed to the browser plug-in of realizing specific function, therefore, when the user opens webpage by browser, at first by the plug-in unit invoking web page script of installing on browser and the browser, then, concrete operations for webpage are then finished by page script, and page script also needs operating result is reported to browser after webpage is operated.This shows, in said process, carry out mutual between the plug-in unit that needs to install on page script and browser and the browser.That is to say that in said process, not only the plug-in unit of installing on browser and the browser is wanted the invoking web page script, and page script also will call the plug-in unit of installing on browser and the browser.
Generally speaking, the plug-in unit of installing on browser and the browser is the invoking web page script very easily, yet it is but very inconvenient that page script will call the plug-in unit of installing on browser and the browser.Concrete reason is, the concrete method of calling during plug-in unit that page script is installed on calling browser and browser is according to the kernel type of browser and different: at the browser of IE kernel, need call by the external interface; And, need call by the another kind of api interface that is different from the external interface at the browser of Chrome kernel.
Summary of the invention
In view of the above problems, the present invention has been proposed so that a kind of exchange method, Apparatus and system that overcomes between the problems referred to above or page script that addresses the above problem at least in part and the browser program is provided.
According to one aspect of the present invention, the exchange method between a kind of page script and the browser program is provided, comprising: receive the call request that page script sends at browser program by default unified interface; Determine the kernel type of browser program correspondence,, determine and the corresponding calling interface of this kernel type according to the kernel type; By calling interface browser program is called.
Alternatively, this method also comprises: receive the result that calls that browser program returns, and will call the result and send page script to.
Alternatively, call browser program by the asynchronous call mode.
Alternatively, calling browser program by the asynchronous call mode comprises: browser program returns by default call back function or trigger event and calls the result.
Alternatively, Yu She unified interface comprises one group of derivative function or interface function.
Alternatively, the kernel type of browser program correspondence comprises IE type and Chrome type, when the kernel type of browser program correspondence is the IE type, with the corresponding calling interface of this kernel type be the external interface; When the kernel type of browser program correspondence is the Chrome type, with the corresponding calling interface of this kernel type be api interface.
Alternatively, browser program comprises: the program of browser correspondence, and/or the program of the plug-in unit correspondence of browser.
According to a further aspect in the invention, provide the interactive device between page script and the browser program, having comprised: receiver module is suitable for receiving the call request at browser program that page script sends by default unified interface; Determination module is suitable for determining the kernel type of browser program correspondence, according to the kernel type, determines and the corresponding calling interface of this kernel type; Calling module is suitable for by calling interface browser program being called.
Alternatively, receiver module also is suitable for receiving the result that calls that browser program returns, and will call the result and send page script to.
Alternatively, receiver module calls browser program by the asynchronous call mode.
Alternatively, receiver module calls browser program by the asynchronous call mode and comprises: browser program returns by default call back function or trigger event and calls the result.
Alternatively, Yu She unified interface comprises one group of derivative function or interface function.
Alternatively, the kernel type of browser program correspondence comprises IE type and Chrome type, when the kernel type of browser program correspondence is the IE type, with the corresponding calling interface of this kernel type be the external interface; When the kernel type of browser program correspondence is the Chrome type, with the corresponding calling interface of this kernel type be api interface.
Alternatively, browser program comprises: the program of browser correspondence, and/or the program of the plug-in unit correspondence of browser.
Alternatively, device is integrated into an independently functional module.
Alternatively, install and be dynamic link library or code segment.
Alternatively, device is integrated in the browser program.
According to a further aspect in the invention, provide the interactive system between a kind of page script and the browser program, having comprised: page script, browser program and above-mentioned interactive device.
According to the exchange method between page script of the present invention and the browser program, Apparatus and system, can receive the call request of page script by default unified interface at browser program, therefore when page script calls browser program, need not to consider the kernel type of browser, as long as call request is sent to this unified interface.Solved page script of the prior art problem owing to the complex operation that needs differentiation kernel type to be caused when calling browser program thus, obtained and can unify to call for the browser of different kernel types, thus the beneficial effect of simplification call flow.
Above-mentioned explanation only is the general introduction of technical solution of the present invention, for can clearer understanding technological means of the present invention, and can be implemented according to the content of instructions, and for above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Description of drawings
By reading hereinafter detailed description of the preferred embodiment, various other advantage and benefits will become cheer and bright for those of ordinary skills.Accompanying drawing only is used to illustrate the purpose of preferred implementation, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts with identical reference symbol.In the accompanying drawings:
Fig. 1 shows the page script that the embodiment of the invention provides and the process flow diagram of the exchange method between the browser program;
Fig. 2 shows the page script that the embodiment of the invention provides and the structural drawing of the interactive device between the browser program; And
Fig. 3 shows the page script that the embodiment of the invention provides and the structural drawing of the interactive system between the browser program.
Embodiment
Exemplary embodiment of the present disclosure is described below with reference to accompanying drawings in more detail.Though shown exemplary embodiment of the present disclosure in the accompanying drawing, yet should be appreciated that and to realize the disclosure and the embodiment that should do not set forth limits here with various forms.On the contrary, it is in order to understand the disclosure more thoroughly that these embodiment are provided, and can with the scope of the present disclosure complete convey to those skilled in the art.
The embodiment of the invention provides exchange method, the Apparatus and system between a kind of page script and the browser program, the problem of the complex operation that is caused owing to needs differentiation kernel type when calling browser program in order to solve present page script.
Fig. 1 shows the page script that the embodiment of the invention provides and the process flow diagram of the exchange method between the browser program.In the following description, the executive agent of this method for example can be an integrated independently functional module.This functional module for example can be dynamic link library or class libraries (being dll), or code segment etc.This functional module can be embedded in the browser program and (promptly loads this functional module by browser program),, perhaps, this functional module also can be used as an intermediate module that is independent of browser program and page script.
As shown in Figure 1, this method starts from step S110.In step S110, receive the call request that page script sends at browser program by default unified interface.Wherein, page script comprises all kinds of shell scripts of writing by various script.Default unified interface comprises one group of derivative function or interface function.Particularly, when the functional module of this method of execution was dynamic link library or class libraries, this unified interface was generally one group of derivative function; When the functional module of this method of execution was code segment, this unified interface was generally a group interface function.
By step S110, receive after the call request of above-mentioned page script to browser program by unified interface, in step S120, determine the kernel type of browser program correspondence, according to the kernel type of determining, further determine and the corresponding calling interface of this kernel type.Wherein, the kernel type of browser program correspondence comprises IE type and Chrome type, when the kernel type of browser program correspondence is the IE type, with the corresponding calling interface of this kernel type be the external interface; When the kernel type of browser program correspondence is the Chrome type, with the corresponding calling interface of this kernel type be api interface.
Determine after the corresponding calling interface by step S120, in step S130, browser program is called by this calling interface (for example above-mentioned external interface or api interface).Further, after step S130, can also comprise step S140.Under the situation that has the result of calling to return, in step S140, receive the result that calls that browser program returns, and this is called the result send this page script to, finish once mutual between page script and the browser program thus.Those skilled in the art can understand, and this return results is not necessarily necessary.
Particularly, when realizing page script and browser program mutual by step S130 and step S140, can realize page script calling by the mode of asynchronous call to browser program.That is to say, after browser program being called by step S130, called side (functional module of the call operation among the execution in step S130) does not wait quilt accent side (browser program) to return and calls the result, just directly carry out other follow-up operations, when browser program returns when calling as a result, called side receives this again and calls the result.
Compare with the synchronization call mode of routine, the asynchronous call mode has following advantage: in the synchronization call mode, after browser program is called by page script, could respond (promptly return and call the result) after often needing a period of time, and page script before browser program response during this period of time in also can't carry out other follow-up operations, could carry out subsequent operation after can only waiting until the browser program response, waste a large amount of time thus.And the asynchronous call mode is quite different, after page script calls browser program, need not to be parked in the original place and wait for the browser program response, therefore, page script during this period of time can continue to carry out other operations, and by the time browser program returns and receives this when calling as a result again and call the result and handle and get final product.
In order to realize the mode of above-mentioned asynchronous call, just need a kind of mechanism that can return notice called side when calling as a result in quilt accent side.For example, can realize this mechanism by default multiple modes such as call back function, trigger event and/or response message.Particularly, if realize asynchronous call by default call back function, then called side is when calling this default call back function, in the parameter of call back function, be provided with one and be used to receive the function address that calls the result (also being pointer) that is returned by accent side, therefore, call back function returns in quilt accent side can directly get access to by this function address when calling as a result and calls the result and be notified to called side.If realize asynchronous call by the preset trigger incident, then need call back function is packaged in the object, use incident (event) to replace wherein function address then, and give notice to called side by event handler being returned by accent side when calling as a result.
In the exchange method that the embodiment of the invention provides, can receive the call request of page script by default unified interface at browser program, therefore when page script calls browser program, need not to consider the kernel type of browser, as long as call request is sent to this unified interface.Solved page script of the prior art problem owing to the complex operation that needs differentiation kernel type to be caused when calling browser program thus, obtained and can unify to call for the browser of different kernel types, thus the beneficial effect of simplification call flow.In addition, because in embodiments of the present invention, page script can call browser program by the asynchronous call mode, therefore, has reduced the stand-by period, has improved and has called efficient.
In addition, the browser program of mentioning in embodiments of the present invention comprises: the program of browser correspondence, and/or the pairing program of the plug-in unit of installing on this browser.That is to say that in embodiments of the present invention, page script both can call the program of browser correspondence, also can call the pairing program of the plug-in unit of installing on the browser.
Realization details when introducing page script in detail and call the program of browser correspondence and page script and call the pairing program of plug-in unit of installing on the browser with two concrete examples below.
Example one,
In this example, the program of calling the browser correspondence with page script is that example describes.Wherein, page script is the JS script, and its fundamental purpose of calling browser is to obtain the version information of browser, and shows this version information by script bullet window.Owing to exist certain corresponding relation between the version information of browser and the kernel type of browser, therefore, just can judge the kernel type of browser by this version information.If the kernel type of judging is the IE type, then in subsequent process, call by the external interface; If the kernel type of judging is the Chrome type, then in subsequent process, call by api interface.
In order to realize that the JS script calls browser and obtains the process of browser version information, at first need be by the GetVersion method (C++ method) in the GetBrowserVersion function call browser in the JS script.Then, browser is after the GetVersion method executes, and the CallBack method in the readjustment JS script is called the result so that return.
Wherein, the code of the GetVersion method of the GetBrowserVersion function call browser in the JS script is as follows:
By above-mentioned code as can be seen, the JS script calls the GetVersion method of browser program by the functional module in the embodiment of the invention (for example class libraries) the unified interface function (external.AppCmd) that is provided.Wherein, unified interface Function e xternal.AppCmd has four parameters: first parameter " sid " is safe id; What second parameter " 360SE " indicated to call is browser; The method of the browser that the 3rd parameter " GetVersion " indicates to call (C++ method), this method is used to obtain the version information of browser; The 4th, the 5th parameter is extra additional parameter, do not need herein; The 6th parameter " CallBack " is the call back function of JS script, and after this method of GetVersion was finished, this " CallBack " function of readjustment can return to the JS script and call the result.
After browser program receives the call request that above-mentioned JS script sends by unified interface Function e xternal.AppCmd, handle and return by following code and call the result:
Obtain to carry out following statement after the browser version information, version information is returned the script to JS as calling the result, wherein, represent to call the result by the value in the strValue variable.
After executing above-mentioned C++ program, with the CallBack function of readjustment in the script, the strValue that in above-mentioned C++ program, transmits just below msg in the parameter.Wherein, the specific code of CallBack function is as follows:
Wherein, call back function CallBack has two parameters, and one is code, and one is msg.Wherein, code is exactly the code " _ Browser.ResponseExtensionAppCmd (hFrame, hBrowser, nInvokId, 1, UTF8Encode (strValue.c_str ()) .c_str ()) in the above-mentioned code segment; " in parameter 1, and msg is exactly " UTF8Encode (strValue.c_str ()) .c_str () " in this code.Particularly, " code " is used for expression and calls the result, and for example " 1 " is represented successfully, " 0 " expression failure; " UTF8Encode (strValue.c_str ()) .c_str () " then represents the version information that obtained by the GetVersion method in the C++ code.
Just realized mutual between JS script and the browser by top program code.Generally speaking, directly do not carry out alternately between JS script and the browser, but undertaken alternately by the functional module (for example class libraries) that the embodiment of the invention provides with unified interface (comprise external.AppCmd, ExteralMsg and _ interface functions such as Browser.ResponseExtensionAppCmd).The JS script sends the call request of calling browser by unified interface external.AppCmd to this functional module, after this functional module receives this call request, this call request is sent to browser.Then, browser by the ExteralMsg interface and _ the Browser.ResponseExtensionAppCmd interface returns to this functional module and calls the result, this functional module will be called the result and return to the JS script, thereby realize once complete mutual.This shows, the JS script is when calling browser, only needing to send request by unified interface to this functional module gets final product, concrete processing procedure (for example, judge operations such as browser kernel type) realize by this functional module, the JS script needn't be concerned about concrete realization details, also needn't be concerned about the type of browser kernel, thereby has simplified call operation.In addition, in above-mentioned code, also realized the asynchronous call of JS script, improved and called efficient browser by call back function CallBack.
Example two,
In this example, calling the pairing program of the plug-in unit of installing on the browser with page script is that example describes.Wherein, this example can be used as an independent example and realizes, also can be used as the judgement browser kernel type subsequent operation afterwards that executes in the example one and realizes.
Particularly, in this example, the plug-in unit of installing on the browser is the login house keeper, and page script is the JS script.Be that example is introduced the JS script and called the implementation procedure of login during house keeper below with the specific code:
At first, the JS script is by the GetAjaxCode method among the login house keeper of the CallBackSID function call in the following code (LoginAssis), after the GetAjaxCode method is finished, can adjust back the CallBack function in the following code, will call the result by the CallBack function and return to the JS script.
Wherein, the JS script is as follows by CallBackSID function call login house keeper's specific code:
By above-mentioned code as can be seen, the CallBackSID function has two parameters, is respectively code and msg, and wherein, the parameter value of code is represented return results, and msg represents safe ID, the ID when promptly the user logins number.And, the unified interface function (external.AppCmd) that the CallBackSID function provides by the functional module in the embodiment of the invention calls login house keeper (LoginAssis), and, in this unified interface function, also defined and be used to receive the call back function CallBack that calls the result, to realize asynchronous call.
This functional module by this unified interface function receive the JS script to the login house keeper call request and with this call request send to the login house keeper after, the login house keeper respond by the unified interface function (ExteralMsg) that this functional module provides:
Obtain after the relevant data information, the login house keeper call the unified interface function that this functional module provides (_ Browser.ResponseExtensionAppCmd) carry out following statement, to call the result and return the script to JS, wherein, the result is exactly the value in the strValue variable.
Particularly, when passback is called as a result, the login house keeper will adjust back the CallBack function in the JS script, return to the JS script by the CallBack function and call the result.Particularly, the function code of CallBack function is as follows:
By above-mentioned code as can be seen, call back function CallBack also has two parameters, and a parameter is code, and another parameter is msg.Wherein, the code parameter is used for expression passback and calls result's success or failure, particularly, the code parameter be exactly above mention be used to return the code segment that calls the result " _ Browser.ResponseExtensionAppCmd (hFrame; hBrowser; nInvokId, 1, UTF8Encode (strValue.c_str ()) .c_str ()); " in the 4th parameter, in this code segment, the parameter value of the 4th parameter is 1, expression passback result success, if passback result failure, then the parameter value of the 4th parameter is 0.Just this calls whether success to parameter value by the code parameter as can be seen.And the msg parameter is used to represent the numerical value that calls the result that returns, particularly, the msg parameter be exactly the code segment that is used to return the result above mentioned " _ Browser.ResponseExtensionAppCmd (hFrame; hBrowser; nInvokId; 1, UTF8Encode (strValue.c_str ()) .c_str ()); " in last parameter UTF8Encode (strValue.c_str ()) .c_str ().Just can obtain the concrete result that calls by the msg parameter, in the CallBack function, with get access to call the result split into four sections be used for the login.
Just realized mutual between the house keeper of JS script and login by top program code.Generally speaking, JS script and login are not directly carried out between the house keeper mutual, but are undertaken alternately by the functional module (for example class libraries) with unified interface (comprise external.AppCmd, ExteralMsg and _ interface functions such as Browser.ResponseExtensionAppCmd) that the embodiment of the invention provides.The JS script sends the call request of calling the login house keeper by unified interface external.AppCmd to this functional module, after this functional module receives this call request, this call request is sent to the login house keeper.Then, the login house keeper by the ExteralMsg interface and _ the Browser.ResponseExtensionAppCmd interface returns to this functional module and calls the result, this functional module will be called the result and return to the JS script, thereby realize once complete mutual.This shows, the JS script is when calling the login house keeper, only needing to send request by unified interface to this functional module gets final product, concrete processing procedure is realized by this functional module, the JS script needn't be concerned about concrete realization details, also needn't be concerned about the type of browser kernel, thereby simplify call operation.In addition, in above-mentioned code, also realized the asynchronous call of JS script, improved and called efficient the login house keeper by call back function CallBack.
By above-mentioned two examples as can be seen, no matter page script is the program of calling the browser correspondence, still call the program of the plug-in unit correspondence of installing on the browser, the unified interface that provides in can the method by the embodiment of the invention realizes, thereby simplified the invoked procedure of page script.
Fig. 2 shows the page script that the embodiment of the invention provides and the structural drawing of the interactive device between the browser program 20.This interactive device 20 can be integrated into an independently functional module, also can be integrated in this browser program.This interactive device 20 for example can be by dynamic link library or class libraries (being dll), or realization such as code segment.
As shown in Figure 2, this interactive device 20 comprises receiver module 21, determination module 22 and calling module 23.
Wherein, receiver module 21 receives the call request at browser program that page script sends by default unified interface.Wherein, page script comprises all kinds of shell scripts of writing by various script.Default unified interface comprises one group of derivative function or interface function.Particularly, when this interactive device was dynamic link library or class libraries, this unified interface was generally one group of derivative function; When this interactive device was code segment, this unified interface was generally a group interface function.
Determination module 22 is determined the kernel type of browser program correspondence, according to the kernel type of determining, further determines and the corresponding calling interface of this kernel type.Wherein, the kernel type of browser program correspondence comprises IE type and Chrome type, when the kernel type of browser program correspondence is the IE type, with the corresponding calling interface of this kernel type be the external interface; When the kernel type of browser program correspondence is the Chrome type, with the corresponding calling interface of this kernel type be api interface.
The calling interface that calling module 23 is determined by determination module 22 (for example above-mentioned external interface or api interface) calls browser program.
Further, under the situation that has the result of calling to return, receiver module 21 also is suitable for receiving the result that calls that browser program returns, and this is called the result sends this page script to, finishes once mutual between page script and the browser program thus.Those skilled in the art can understand, and this return results is not necessarily necessary.
Particularly, when realizing page script and browser program mutual, can realize page script by the mode of asynchronous call to the calling of browser program, for example, can realize by default multiple modes such as call back function, trigger event and/or response message.Particularly, if realize asynchronous call by default call back function, then called side is when calling this default call back function, in the parameter of call back function, be provided with one and be used to receive the function address that calls the result (also being pointer) that is returned by accent side, therefore, call back function returns in quilt accent side can directly get access to by this function address when calling as a result and calls the result and be notified to called side.If realize asynchronous call by the preset trigger incident, then need call back function is packaged in the object, use incident (event) to replace wherein function address then, and give notice to called side by event handler being returned by accent side when calling as a result.
In the interactive device that the embodiment of the invention provides, can receive the call request of page script by default unified interface at browser program, therefore when page script calls browser program, need not to consider the kernel type of browser, as long as call request is sent to this unified interface.Solved page script of the prior art problem owing to the complex operation that needs differentiation kernel type to be caused when calling browser program thus, obtained and can unify to call for the browser of different kernel types, thus the beneficial effect of simplification call flow.In addition, because in embodiments of the present invention, page script can call browser program by the asynchronous call mode, therefore, has reduced the stand-by period, has improved and has called efficient.
In addition, the browser program of mentioning in embodiments of the present invention comprises: the program of browser correspondence, and/or the pairing program of the plug-in unit of installing on this browser.That is to say that in embodiments of the present invention, page script both can call the program of browser correspondence, also can call the pairing program of the plug-in unit of installing on the browser.
But the example one among the realization details reference method embodiment when calling the program of browser correspondence and page script and call the pairing program of plug-in unit of installing on the browser about page script and the description of example two repeat no more herein.
Fig. 3 shows the page script that the embodiment of the invention provides and the structural drawing of the interactive system between the browser program.As shown in Figure 3, this system comprises page script 10, interactive device 20 and browser program 30.Wherein, the unified interface that page script 10 provides by interactive device 20 is initiated the call request to browser program 30, interactive device 20 is used for sending this call request to browser program 30, this interactive device 20 also is used for receiving the result that calls that browser program returns by default unified interface, and this is called the result send page script 10 to, so that realize calling between page script and the browser program.Wherein, the concrete structure of interactive device 20 and function repeat no more referring to the description of said apparatus embodiment herein.
According to the exchange method between page script of the present invention and the browser program, Apparatus and system, can receive the call request of page script by default unified interface at browser program, therefore when page script calls browser program, need not to consider the kernel type of browser, as long as call request is sent to this unified interface.Solved page script of the prior art problem owing to the complex operation that needs differentiation kernel type to be caused when calling browser program thus, obtained and can unify to call for the browser of different kernel types, thus the beneficial effect of simplification call flow.
Intrinsic not relevant at this algorithm that provides with any certain computer, virtual system or miscellaneous equipment with demonstration.Various general-purpose systems also can be with using based on the teaching at this.According to top description, it is conspicuous constructing the desired structure of this type systematic.In addition, the present invention is not also at any certain programmed language.Should be understood that and to utilize various programming languages to realize content of the present invention described here, and the top description that language-specific is done is in order to disclose preferred forms of the present invention.
In the instructions that is provided, a large amount of details have been described herein.Yet, can understand, embodiments of the invention can be put into practice under the situation of these details not having.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand one or more in each inventive aspect, in the description to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes in the above.Yet the method for the disclosure should be construed to the following intention of reflection: promptly the present invention for required protection requires the more feature of feature clearly put down in writing than institute in each claim.Or rather, as following claims reflected, inventive aspect was to be less than all features of the disclosed single embodiment in front.Therefore, follow claims of embodiment and incorporate this embodiment thus clearly into, wherein each claim itself is all as independent embodiment of the present invention.
Those skilled in the art are appreciated that and can adaptively change and they are arranged in one or more equipment different with this embodiment the module in the equipment among the embodiment.Can be the module among the embodiment or unit or the synthetic module of component groups or unit or assembly, and can be divided into a plurality of submodules or subelement or sub-component to them in addition.In such feature and/or process or unit at least some are mutually repelling, and can adopt any combination to disclosed all features in this instructions (comprising claim, summary and the accompanying drawing followed) and so all processes or the unit of disclosed any method or equipment make up.Unless clearly statement in addition, disclosed each feature can be by providing identical, being equal to or the alternative features of similar purpose replaces in this instructions (comprising claim, summary and the accompanying drawing followed).
In addition, those skilled in the art can understand, although embodiment more described herein comprise some feature rather than further feature included among other embodiment, the combination of features of different embodiment means and is within the scope of the present invention and forms different embodiment.For example, in the following claims, the one of any of embodiment required for protection can be used with array mode arbitrarily.
Each parts embodiment of the present invention can realize with hardware, perhaps realizes with the software module of moving on one or more processor, and perhaps the combination with them realizes.It will be understood by those of skill in the art that and to use microprocessor or digital signal processor (DSP) to realize in practice according to some or all some or repertoire of parts in the browser client of the embodiment of the invention.The present invention can also be embodied as part or all equipment or the device program (for example, computer program and computer program) that is used to carry out method as described herein.Such realization program of the present invention can be stored on the computer-readable medium, perhaps can have the form of one or more signal.Such signal can be downloaded from internet website and obtain, and perhaps provides on carrier signal, perhaps provides with any other form.
It should be noted the foregoing description the present invention will be described rather than limit the invention, and those skilled in the art can design alternative embodiment under the situation of the scope that does not break away from claims.In the claims, any reference symbol between bracket should be configured to restriction to claim.Word " comprises " not to be got rid of existence and is not listed in element or step in the claim.Being positioned at word " " before the element or " one " does not get rid of and has a plurality of such elements.The present invention can realize by means of the hardware that includes some different elements and by means of the computing machine of suitably programming.In having enumerated the unit claim of some devices, several in these devices can be to come imbody by same hardware branch.Any order is not represented in the use of word first, second and C grade.Can be title with these word explanations.
The present patent application discloses the exchange method between A1, a kind of page script and the browser program, comprising: receive the call request at described browser program that described page script sends by default unified interface; Determine the kernel type of described browser program correspondence,, determine and the corresponding calling interface of this kernel type according to described kernel type; By described calling interface described browser program is called.A2, as the described method of A1, also comprise: receive the result that calls that described browser program returns, and send the described result of calling to described page script.A3, as the described method of A2, wherein, call described browser program by the asynchronous call mode.A4, as the described method of A3, describedly call described browser program by the asynchronous call mode and comprise: described browser program returns by default call back function or trigger event and calls the result.A5, as each described method among the A1-A4, described default unified interface comprises one group of derivative function or interface function.A6, as each described method among the A1-A5, the kernel type of described browser program correspondence comprises IE type and Chrome type, when the kernel type of described browser program correspondence was the IE type, the described and corresponding calling interface of this kernel type was the external interface; When the kernel type of described browser program correspondence was the Chrome type, the described and corresponding calling interface of this kernel type was an api interface.A7, as each described method among the A1-A6, described browser program comprises: the program of browser correspondence, and/or the program of the plug-in unit correspondence of described browser.
The present patent application also discloses the interactive device between B8, a kind of page script and the browser program, comprising: receiver module is suitable for receiving the call request at described browser program that described page script sends by default unified interface; Determination module is suitable for determining the kernel type of described browser program correspondence, according to described kernel type, determines and the corresponding calling interface of this kernel type; Calling module is suitable for by described calling interface described browser program being called.B9, as the described device of B8, described receiver module also is suitable for receiving the result that calls that described browser program returns, and sends the described result of calling to described page script.B10, as the described device of B9, wherein, described receiver module calls described browser program by the asynchronous call mode.B11, as the described device of B10, described receiver module calls described browser program by the asynchronous call mode and comprises: described browser program returns by default call back function or trigger event and calls the result.B12, as each described device among the B8-B11, described default unified interface comprises one group of derivative function or interface function.B13, as each described device among the B8-B12, the kernel type of described browser program correspondence comprises IE type and Chrome type, when the kernel type of described browser program correspondence was the IE type, the described and corresponding calling interface of this kernel type was the external interface; When the kernel type of described browser program correspondence was the Chrome type, the described and corresponding calling interface of this kernel type was an api interface.B14, as each described device among the B8-B13, described browser program comprises: the program of browser correspondence, and/or the program of the plug-in unit correspondence of described browser.B15, as each described device among the B8 to B14, described device is integrated into an independently functional module.B16, as each described device among the B8-B15, described device is dynamic link library or code segment.B17, as each described device among the B8 to B14, described device is integrated in the described browser program.
The present patent application also discloses the interactive system between C18, a kind of page script and the browser program, comprising: each described interactive device of page script, browser program and above-mentioned B8 to B17.

Claims (10)

1. the exchange method between page script and the browser program comprises:
Receive the call request that described page script sends by default unified interface at described browser program;
Determine the kernel type of described browser program correspondence,, determine and the corresponding calling interface of this kernel type according to described kernel type;
By described calling interface described browser program is called.
2. the method for claim 1 also comprises: receive the result that calls that described browser program returns, and send the described result of calling to described page script.
3. method as claimed in claim 2 wherein, is called described browser program by the asynchronous call mode.
4. method as claimed in claim 3, describedly call described browser program by the asynchronous call mode and comprise: described browser program returns by default call back function or trigger event and calls the result.
5. as each described method among the claim 1-4, described default unified interface comprises one group of derivative function or interface function.
6. as each described method among the claim 1-5, the kernel type of described browser program correspondence comprises IE type and Chrome type, when the kernel type of described browser program correspondence was the IE type, the described and corresponding calling interface of this kernel type was the external interface; When the kernel type of described browser program correspondence was the Chrome type, the described and corresponding calling interface of this kernel type was an api interface.
7. as each described method among the claim 1-6, described browser program comprises: the program of browser correspondence, and/or the program of the plug-in unit correspondence of described browser.
8. the interactive device between page script and the browser program comprises:
Receiver module is suitable for receiving the call request at described browser program that described page script sends by default unified interface;
Determination module is suitable for determining the kernel type of described browser program correspondence, according to described kernel type, determines and the corresponding calling interface of this kernel type;
Calling module is suitable for by described calling interface described browser program being called.
9. device as claimed in claim 8, described receiver module also are suitable for receiving the result that calls that described browser program returns, and send the described result of calling to described page script.
10. the interactive system between page script and the browser program, comprising: page script, browser program and aforesaid right require 8 to 9 each described interactive devices.
CN201310172308.XA 2013-05-10 2013-05-10 Exchange method between page script and browser program, Apparatus and system Active CN103226474B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310172308.XA CN103226474B (en) 2013-05-10 2013-05-10 Exchange method between page script and browser program, Apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310172308.XA CN103226474B (en) 2013-05-10 2013-05-10 Exchange method between page script and browser program, Apparatus and system

Publications (2)

Publication Number Publication Date
CN103226474A true CN103226474A (en) 2013-07-31
CN103226474B CN103226474B (en) 2016-09-28

Family

ID=48836939

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310172308.XA Active CN103226474B (en) 2013-05-10 2013-05-10 Exchange method between page script and browser program, Apparatus and system

Country Status (1)

Country Link
CN (1) CN103226474B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440151A (en) * 2013-09-05 2013-12-11 北京京东尚科信息技术有限公司 Method and apparatus for dynamically loading Web page
CN104375849A (en) * 2013-08-15 2015-02-25 腾讯科技(深圳)有限公司 Core loading method and device
CN104866383A (en) * 2015-05-29 2015-08-26 北京金山安全软件有限公司 Interface calling method, apparatus, and terminal
CN104881318A (en) * 2015-05-07 2015-09-02 北京金山安全软件有限公司 Interface calling method, apparatus and terminal
CN105573733A (en) * 2014-10-16 2016-05-11 腾讯科技(深圳)有限公司 Communication method for browser and web front end and web front end and system
CN106776074A (en) * 2016-12-26 2017-05-31 湖北省数字证书认证管理中心有限公司 A kind of web plug-in units call method and system based on http
WO2019153492A1 (en) * 2018-02-07 2019-08-15 平安科技(深圳)有限公司 Method for realizing web and native function interaction, and electronic apparatus and readable storage medium
CN110321507A (en) * 2019-07-09 2019-10-11 中国工商银行股份有限公司 Browser cross-domain communication method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102099828A (en) * 2008-07-28 2011-06-15 索尼公司 Client device and associated methodology of accessing networked services
CN102647629A (en) * 2012-04-27 2012-08-22 北京人民广播电台 Content playing method and content playing device
CN103019817A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Method and device for page interaction
CN103024003A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Webpage registering method and device
CN103019818A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Page interaction method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102099828A (en) * 2008-07-28 2011-06-15 索尼公司 Client device and associated methodology of accessing networked services
CN102647629A (en) * 2012-04-27 2012-08-22 北京人民广播电台 Content playing method and content playing device
CN103019817A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Method and device for page interaction
CN103024003A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Webpage registering method and device
CN103019818A (en) * 2012-11-30 2013-04-03 北京奇虎科技有限公司 Page interaction method and device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375849A (en) * 2013-08-15 2015-02-25 腾讯科技(深圳)有限公司 Core loading method and device
CN104375849B (en) * 2013-08-15 2019-01-11 腾讯科技(深圳)有限公司 Load the method and device of kernel
CN103440151A (en) * 2013-09-05 2013-12-11 北京京东尚科信息技术有限公司 Method and apparatus for dynamically loading Web page
CN105573733B (en) * 2014-10-16 2019-01-22 腾讯科技(深圳)有限公司 Method, web front-end and the system that browser is communicated with web front-end
CN105573733A (en) * 2014-10-16 2016-05-11 腾讯科技(深圳)有限公司 Communication method for browser and web front end and web front end and system
CN104881318A (en) * 2015-05-07 2015-09-02 北京金山安全软件有限公司 Interface calling method, apparatus and terminal
CN104881318B (en) * 2015-05-07 2019-06-25 珠海豹趣科技有限公司 A kind of interface call method, device and terminal
CN104866383B (en) * 2015-05-29 2018-11-23 北京金山安全软件有限公司 A kind of interface call method, device and terminal
CN104866383A (en) * 2015-05-29 2015-08-26 北京金山安全软件有限公司 Interface calling method, apparatus, and terminal
CN106776074A (en) * 2016-12-26 2017-05-31 湖北省数字证书认证管理中心有限公司 A kind of web plug-in units call method and system based on http
WO2019153492A1 (en) * 2018-02-07 2019-08-15 平安科技(深圳)有限公司 Method for realizing web and native function interaction, and electronic apparatus and readable storage medium
CN110321507A (en) * 2019-07-09 2019-10-11 中国工商银行股份有限公司 Browser cross-domain communication method and device

Also Published As

Publication number Publication date
CN103226474B (en) 2016-09-28

Similar Documents

Publication Publication Date Title
CN103226474A (en) Method, device and system for interaction between webpage script and browser program
US8209674B2 (en) Tier splitting support for distributed execution environments
US10540417B2 (en) Determining web page processing state
CN102929656B (en) Use method and the client of ActiveX plug-in in browser
US20120042261A1 (en) Sub-component instantiation and synchronization using a shared worker
EP2989552B1 (en) Updating a front end client
CN104536981A (en) Browser safety achieving method, browser client-side and device
CN104036019A (en) Method and device for opening webpage links
US9648078B2 (en) Identifying a browser for rendering an electronic document
CN102981846A (en) Method for treating password input box element and browser for treating the password input box element
CN102915366A (en) Method and device for loading webpage on browser
US8539506B2 (en) Dynamic injection of code into running process
CN103019817A (en) Method and device for page interaction
CN103064680A (en) Plug-in playing method and device in browser
US20090254837A1 (en) Accessing external functionality within a component-based web application
CN103500114A (en) Method and device for installing application program
CN103544271B (en) Load Image in a kind of browser the method and apparatus for processing window
CN103034495A (en) Browser capable of isolating plug-in in webpage and webpage plug-in isolating method
CN103019818A (en) Page interaction method and device
CN102999580A (en) Code input frame element processing method and browser
Adetunji et al. Dawning of Progressive Web Applications (PWA): Edging Out the Pitfalls of Traditional Mobile Development
CN103077047A (en) Plug-in playback method and device
CN103019734A (en) Activity object implementation method, system and browser
CN103559097A (en) Inter-process communication method and device in browser and browser
CN103077016B (en) A kind of moving object creation method, device and browser

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