Summary of the invention
Exploitation caused by more set input methods, maintenance cost is higher asks in order to solve to exist in existing display equipment by the present invention
Topic proposes a kind of method and display equipment for showing the input method of Web application calling UI in equipment, to realize that input method is total
With reduction development and maintenance cost.
For achieving the above object, the present invention provides the following technical scheme that
In a first aspect, the present invention provides a kind of method for showing the input method of Web application calling UI in equipment, the Web
Using the first browser is run on, the UI runs on the second browser, which comprises
The Web applies the first interface by calling first browser, so that first browser is to described
Second browser sends first message, and the first message is used to indicate the input method that the UI is called in the Web application;
Second browser receives the first message, generates the corresponding second browser thing of the first message
Part, so that calling the input method after the UI listens to second browser event.
Optionally, after the calling input method, further includes:
The UI calls the second interface of second browser, so that second browser is to first browser
Second message is sent, the second message includes the information that user is inputted by the input method;
First browser receives the second message, generates the corresponding first browser thing of the second message
Part, so that after Web application listens to first browser event, acquisition first browser event includes described
The information of user's input.
Optionally, first browser sends first message to second browser, comprising:
The first message is sent to message distribution module by first browser, is disappeared in the first message comprising it
Breath source and message destination, the message source indicate the Web application, and the message destination indicates the UI;
The first message is sent to described by the message distribution module according to the message destination of the first message
Second browser.
Optionally, second browser sends second message to first browser, comprising:
The second message is sent to message distribution module by second browser, is disappeared in the second message comprising it
Breath source and message destination, the message source indicate the UI, and the message destination indicates the Web application;
The second message is sent to described by the message distribution module according to the message destination of the second message
First browser.
Optionally, first browser or second browser by RPC agreement and the message distribution module into
Row message communicating.
Second aspect, the present invention also provides a kind of display equipment, including processor and machine readable storage medium, the machines
Device readable storage medium storing program for executing is stored with the machine-executable instruction that can be executed by the processor, and the processor is by the machine
Executable instruction promotes: the method for realizing the input method of Web application calling UI in above-mentioned display equipment.
The third aspect, the present invention also provides a kind of machine readable storage medium, storage in the machine readable storage medium
There is machine-executable instruction, when the machine-executable instruction is executed by processor, realizes that Web application is adjusted in above-mentioned display equipment
With the method for the input method of UI.
Browser where browser and UI where the embodiment of the present invention is applied by Web it can be seen from above description it
Between information exchange, make Web application can call the input method of UI, thus realize input method share, save exploitation, maintenance cost,
System resource is reduced to occupy.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended
The example of device and method being described in detail in claims, some aspects of the invention are consistent.
It is only to be not intended to limit the invention merely for for the purpose of describing particular embodiments in terminology used in the present invention.
It is also intended in the present invention and the "an" of singular used in the attached claims, " described " and "the" including majority
Form, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to and wraps
It may be combined containing one or more associated any or all of project listed.
Display equipment is generally fitted with the Web application that UI and various third parties provide.The independent fortune of UI and Web application
Row.
UI generally supports input function, meets the input demand of user.More and more Web applications also require to support input
Function, for this purpose, developer develops input method in Web application.This causes to show that equipment has more set input methods, and increase is opened
Hair, maintenance cost, and occupying system resources.
In view of the above-mentioned problems, the present invention proposes a kind of method for showing the input method of Web application calling UI in equipment, the party
Information exchange between browser where method is applied by Web and the place UI browser, makes Web application call the input method of UI,
To realize that input method shares, exploitation, maintenance cost are saved, system resource is reduced and occupies.
To make the objectives, technical solutions, and advantages of the present invention clearer, right in the following with reference to the drawings and specific embodiments
The present invention is described in detail:
It is the method for the input method that UI is called in Web application in a kind of display equipment shown in the embodiment of the present invention referring to Fig. 1
Flow chart.
In the embodiment of the present invention, UI and Web application are based on the realization of Web technology, therefore, can run on browser environment.
Wherein, Web application runs on the first browser, and UI runs on the second browser.
Here, the first browser, the second browser be the name that carries out convenient for differentiation, be not used to limit.
As shown in Figure 1, the process can comprise the following steps that
Step 101, Web applies the first interface by calling the first browser, so that the first browser is browsed to second
Device sends first message.
In the first browser, first interface can be pre-defined.The first interface is used to indicate the first browser to second
Browser sends first message.
As an implementation, which can be JavaScript interface.That is, being extended using JavaScript real
Existing interface.
When Web application is needed using input method, first interface can be called directly, the first browser of triggering is browsed to second
Device sends first message, which is used to indicate the input method that UI is called in Web application.
Here, first interface, first message be the name that carries out convenient for differentiation, be not used to limit.
Realize that the first browser sends message to the second browser by this step.
Step 102, the second browser receives first message, generates corresponding second browser event of first message, makes
After UI listens to the second browser event, call input method.
In the second browser, the event that pre-defined second browser can identify, referred to as the second browser event.It should
There are corresponding relationships with first message for second browser event.
When the second browser receives first message, corresponding second browser event of the first message is generated.
UI after listening to the second browser event, opens the local input method page by event monitoring mechanism, i.e., itself
Input method, so as to user input Web application information needed.
So far, process shown in Fig. 1 is completed.
As can be seen from the flow chart shown in fig. 1, it is browsed where browser where the embodiment of the present invention is applied using Web and UI
Information exchange between device makes Web application that can call directly the input method of UI, to realize that input method shares, reduces exploitation, dimension
Cost is protected, system resource is saved.
Optionally, as one embodiment, after executing step 102, it can also carry out process shown in Fig. 2.Referring to fig. 2,
The implementation process that user inputs information is obtained for the Web application shown in the embodiment of the present invention.
As shown in Fig. 2, the process can comprise the following steps that
Step 201, UI calls the second interface of the second browser, so that the second browser sends second to the first browser
Message.
In the second browser, second interface can be pre-defined.The second interface is used to indicate the second browser to first
Browser sends second message.
As an implementation, which can be JavaScript interface.That is, being extended using JavaScript real
Existing interface.
After abovementioned steps 102 open the input method page of UI, user inputs Web using required letter on the input method page
Breath.
After the completion of confirmation message input, UI calls second interface, and the second browser of triggering sends the to the first browser
Two message.The second message includes the information that user inputs on the input method page.
Here, second interface, second message be the name that carries out convenient for differentiation, be not used to limit.
Realize that the second browser sends message to the first browser by this step.
Step 202, the first browser receives second message, generates corresponding first browser event of second message, makes
Web is obtained using the information for after listening to the first browser event, obtaining user's input that the first browser event includes.
In the first browser, the event that pre-defined first browser can identify, referred to as the first browser event.It should
There are corresponding relationships with second message for first browser event.
When the first browser receives second message, corresponding first browser event of the second message is generated.This
One browser event includes the information that user inputs on the input method page of UI.
Web is applied through event monitoring mechanism, and after listening to the first browser event, obtaining the first browser event includes
User input information.
That is, Web application gets the information inputted by UI input method.
So far, process shown in Fig. 2 is completed.
It may be implemented by process shown in Fig. 2, the information inputted using UI input method passed into Web application.Web application
In no longer need to develop input method, reduce exploitation, maintenance cost.
Optionally, as one embodiment, first is sent to the second browser to the first browser in step 101 below and is disappeared
The process of breath is described.It is the implementation process of the step 101 shown in the embodiment of the present invention referring to Fig. 3.
As shown in figure 3, the process can comprise the following steps that
Step 301, first message is sent to message distribution module by the first browser.
In the embodiment of the present invention, display equipment includes message distribution module.
When the first browser needs to send first message to the second browser, which can be sent to message point
Module is sent out, is forwarded from message distribution module to the second browser.
As an implementation, the first browser can based on RPC (Remote Procedure Call Protocol,
Remote procedure call) agreement to message distribution module send first message.
It include message source and message destination in the first message, wherein message source indicates Web application, message destination
Indicate UI.
Step 302, first message is sent to the second browsing according to the message destination of first message by message distribution module
Device.
Message distribution module record has the corresponding relationship of the mark and the mark of the second browser of UI.It therefore, can be according to
The message destination (UI) of one message, inquires above-mentioned corresponding relationship, and first message is sent to the second browser.
So far, process shown in Fig. 3 is completed.
It may be implemented by process shown in Fig. 3, the first browser sends first message to the second browser.
Optionally, as one embodiment, second is sent to the first browser to the second browser in step 201 below and is disappeared
The process of breath is described.It referring to fig. 4, is the implementation process of the step 201 shown in the embodiment of the present invention.
As shown in figure 4, the process can comprise the following steps that
Step 401, second message is sent to message distribution module by the second browser.
When the second browser needs to send second message to the first browser, second message can be sent to message distribution
Module is forwarded from message distribution module to the first browser.
As an implementation, the second browser can send second message to message distribution module based on RPC agreement.
It include message source and message destination in second message, wherein message source indicates UI, and message destination indicates Web
Using.
Step 402, second message is sent to the first browsing according to the message destination of second message by message distribution module
Device.
The corresponding relationship of mark and the mark of the first browser that message distribution module record has Web to apply.It therefore, can root
According to the message destination (Web application) of second message, above-mentioned corresponding relationship is inquired, second message is sent to the first browser.
So far, process shown in Fig. 4 is completed.
It may be implemented by process shown in Fig. 4, the second browser sends second message to the first browser.
Method provided by the invention is described below by a specific embodiment.
Referring to Fig. 5, for the schematic diagram of the various applications being installed in display equipment 500 shown in the present embodiment.Wherein,
Web is run in browser 511 using 501, and UI502 is run in browser 512.Browser 511 and browser 512 are by disappearing
It ceases distribution module 520 and carries out message communicating.
In browser 511, an interface is pre-defined, Send12 () is denoted as, is used to indicate browser 511 to browser
512 send Web using the message (being denoted as Message12) of UI input method.And a browser event is defined, it is denoted as
InputResult, the input information for making Web that can listen to the return of UI input method using 501.
In browser 512, an interface is pre-defined, Send21 () is denoted as, is used to indicate browser 512 to browser
511 send the message (being denoted as Message21) for carrying user's input information.And a browser event is defined, it is denoted as
PreInputText, for making UI502 that can listen to the message that Web applies 501 request call UI input methods.
When Web using 501 need using input method when, can be performed Fig. 6 shown in process, the process the following steps are included:
Step 601, Web calls Send12 () using 501;
Step 602, browser 511 responds Send12 () calling, sends Message12 to message distribution module 520;
The message structure of the Message12 is as shown in table 1.
Message source |
Message destination |
Message content |
Web applies 501 |
UI502 |
|
Table 1
Wherein, message content can add Web according to actual needs and wish to pass to the information of UI502 using 501.
Step 603, message distribution module 520 sends out Message12 according to the message destination (UI502) of Message12
It send to browser 512 where UI502;
Step 604, browser 512 identifies Message12, generates corresponding browser event PreInputText;
Step 605, after UI502 listens to PreInputText, the input method page is opened.
For user on the input method page, input Web applies 501 information needed.
Complete user input after, can be performed Fig. 7 shown in process, the process the following steps are included:
Step 701, UI502 calls Send21 ();
User is entered information as to the input parameter of Send21 ().
Step 702, browser 512 responds Send21 () calling, sends Message21 to message distribution module 520;
The message structure of the Message21 is as shown in table 2.
Message source |
Message destination |
Message content |
UI502 |
Web applies 501 |
User inputs information |
Table 2
Step 703, message distribution module 520, will according to the message destination (Web applies 501) of Message21
Message21 is sent to Web using 501 place browsers 511;
Step 704, browser 511 identifies Message21, generates corresponding browser event InputResult;
It include that user inputs information in InputResult.
Step 705, it after Web listens to InputResult using 501, obtains user and inputs information.
So far, the description of this specific embodiment is completed.
Method provided by the invention is described above, display equipment provided by the invention is described below:
Referring to Fig. 8, for a kind of hardware structural diagram for showing equipment provided in an embodiment of the present invention.The display equipment can
Including processor 801, it is stored with the machine readable storage medium 802 of machine-executable instruction.Processor 801 is deposited with machine readable
Storage media 802 can be communicated via system bus 803.Also, by read and execute in machine readable storage medium 802 with display
The corresponding machine-executable instruction of input method of UI is called in Web application in equipment, and above-described display can be performed in processor 801
The method that the input method of UI is called in Web application in equipment.
The machine readable storage medium 802 being mentioned herein can be any electronics, magnetism, optics or other physical stores dress
It sets, may include or store information, such as executable instruction, data, etc..For example, the machine readable storage medium 802 can be with
Including at least one following kind storage medium: volatile memory, nonvolatile memory, other types of storage media.Wherein, easily
Lose property memory can be RAM (Random AccessMemory, random access memory), nonvolatile memory can for flash memory,
Memory driver (such as hard disk drive), solid state hard disk, storage dish (such as CD, DVD).
The embodiment of the present invention also provides a kind of machine readable storage medium including machine-executable instruction, such as in Fig. 8
Machine readable storage medium 802, the machine-executable instruction can execute by the processor 801 in display equipment, to realize
The method that the input method of UI is called in Web application in display equipment described above.
So far, the description of display equipment shown in Fig. 8 is completed.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.