CN108984278B - Key event processing method, medium and equipment - Google Patents

Key event processing method, medium and equipment Download PDF

Info

Publication number
CN108984278B
CN108984278B CN201810677760.4A CN201810677760A CN108984278B CN 108984278 B CN108984278 B CN 108984278B CN 201810677760 A CN201810677760 A CN 201810677760A CN 108984278 B CN108984278 B CN 108984278B
Authority
CN
China
Prior art keywords
key event
stack
webpage
browser
pressed
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
CN201810677760.4A
Other languages
Chinese (zh)
Other versions
CN108984278A (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.)
Hisense Broadband Multimedia Technology Co Ltd
Original Assignee
Hisense Broadband Multimedia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Broadband Multimedia Technology Co Ltd filed Critical Hisense Broadband Multimedia Technology Co Ltd
Priority to CN201810677760.4A priority Critical patent/CN108984278B/en
Publication of CN108984278A publication Critical patent/CN108984278A/en
Application granted granted Critical
Publication of CN108984278B publication Critical patent/CN108984278B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a method, a medium and equipment for processing a key event, wherein the method for processing the key event comprises the following steps: acquiring a key event sent by a user, and pressing the key event into a stack; transmitting the key event pressed into the stack to a webpage end; if the webpage end does not process the key event pressed into the stack, the key event is popped up; and sending the popped key event to a browser end. Whether the key event is processed by the webpage end is judged through intelligent decision of the key event, on the basis, the processing flow and the path of the key event can be automatically distinguished through delayed processing of the key event, the problem of wrong response of the key event in the webpage is solved, and the flexibility and the adaptability of the product are improved.

Description

Key event processing method, medium and equipment
Technical Field
The invention relates to the technical field of computers, in particular to a method, a medium and equipment for processing a key event.
Background
In an actual IPTV application, a user operates by moving a focus through up, down, left, and right direction keys of a remote controller, and for a general-purpose browser, a response flow of a key event generally includes two types, one is from a web page side to the browser side, and the other is from the browser side to the web page side. For browser-end products oriented to PCs and smart phones, users usually click a target element or a hyperlink directly through a mouse or a touch screen, and response processing of a case event is only completed by the browser end, and a situation that a web page end performs processing by itself and/or browser-end cooperation processing may be required in an IPTV service, so that a general browser end cannot meet special requirements for a key processing process in the IPTV service.
Moreover, after the browser end receives the key event, the browser end does not know whether the webpage end has performed response processing on the key event or not, and does not know that the key event will not be processed again by the webpage end when flowing to the webpage end, so that a situation that the webpage end and the browser end both process the same key event may be caused, which may cause an error situation on the page, and seriously affect user experience.
The browser end customized for the IPTV service has a high customization cost to meet special service requirements, and has a large workload during later modification, which causes problems of poor adaptability and flexibility, and cannot meet requirements of the IPTV service.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a method, a medium and equipment for processing a key event, which solve the problem of response error in the key event in a page and improve the flexibility and adaptability of a product.
In a first aspect, the present invention provides a method for processing a key event, including:
acquiring a key event sent by a user, and pressing the key event into a stack;
transmitting the key event pressed into the stack to a webpage end;
if the webpage end does not process the key event pressed into the stack, the key event is popped up;
and sending the popped key event to a browser end.
Optionally, if the webpage end processes the key event pushed to the stack, the key event is discarded.
Optionally, determining that the webpage end processes the button event pushed to the stack includes:
acquiring the state of a focus control and/or the request state of page resources;
and if the state of the focus control and/or the request state of the page resource changes, determining that the key event is processed at the webpage end.
Optionally, the state change of the focus control means that the browser end detects that a control for acquiring the focus in the page of the web page end is transferred; the change of the request state of the page resource means that the webpage end sends a resource request of a new page to the browser end.
Optionally, after acquiring the key event sent by the user, the method further includes:
judging whether the key event comes from the webpage end;
if yes, discarding the key event;
and if not, pressing the key event into a stack.
In a second aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring a key event sent by a user, and pressing the key event into a stack;
transmitting the key event pressed into the stack to a webpage end;
if the webpage end does not process the key event pressed into the stack, the key event is popped up;
and sending the popped key event to a browser end.
In a third aspect, the present invention also provides a computer device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of:
acquiring a key event sent by a user, and pressing the key event into a stack;
transmitting the key event pressed into the stack to a webpage end;
if the webpage end does not process the key event pressed into the stack, the key event is popped up;
and sending the popped key event to a browser end.
Optionally, if the webpage end processes the key event pushed to the stack, the key event is discarded.
Optionally, determining that the webpage end processes the button event pushed to the stack includes:
acquiring the state of a focus control and/or the request state of page resources;
and if the state of the focus control and/or the request state of the page resource changes, determining that the key event is processed at the webpage end.
Optionally, after acquiring the key event sent by the user, the method further includes:
judging whether the key event comes from the webpage end;
if yes, discarding the key event;
and if not, pressing the key event into a stack.
According to the technical scheme, whether the key event is processed by the webpage end or not is judged through intelligent decision of the key event, and on the basis, the processing flow and path of the key event can be automatically distinguished through delayed processing of the key event, so that the problem of wrong response of the key event in the webpage is solved, and the flexibility and the adaptability of a product are improved.
The invention provides a processing medium and equipment for key events, which are based on the same inventive concept and have the same technical effect as the processing method for key events.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without any inventive exercise.
FIG. 1: fig. 1 shows a flowchart of a method for processing a key event according to a first aspect of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only partial embodiments of the present invention, and not full embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which the invention pertains.
The invention provides a method, a medium and a device for processing a key event, which judge whether the key event is processed by a webpage end or not through intelligent decision of the key event, can automatically distinguish the processing flow and path of the key event through delayed processing of the key event on the basis, solve the problem of wrong response of the key event in a page and improve the flexibility and the adaptability of a product. Embodiments of the present invention will be described below with reference to the drawings.
Fig. 1 is a flowchart illustrating a method for processing a key event according to a first aspect of the present invention. As shown in fig. 1, a method for processing a key event according to a first aspect of the present invention includes the following steps:
step S101: acquiring a key event sent by a user, and pressing the key event into a stack;
step S102: transmitting the key event pressed into the stack to a webpage end;
step S103: if the webpage end does not process the key event pressed into the stack, the key event is popped up;
step S104: and sending the popped key event to a browser end.
Step S105: and if the webpage end processes the key event pressed into the stack, discarding the key event.
In the present invention, the execution body of the processing method of the key event may be a browser end in the IPTV field. The IPTV field is the field of interactive network television.
The browser end in the IPTV field is started to display a webpage, unlike a page opened in a pc browser end, the page is more like a desktop of a mobile phone and has no address input field, and the navigation of the whole page is controlled by a remote controller.
Specifically, the flow process of the key event mainly includes two types, the first type is from the web page side to the browser side, and the other type is from the browser side to the web page side. In an actual IPTV service, because the browser does not know whether the key event has been responded and processed by the web page, or the key event will not be responded and processed by the web page after the browser responds and processes, there may be a problem that the web page and the browser respond and process the key event respectively, which may cause an error, for example, a problem that a focus skips some controls, or the focus cannot be moved to some controls.
In the first case, the keystroke event flows from the web side to the browser side. In order to avoid that after the browser end acquires the key event sent by the user, the browser end firstly needs to judge whether the webpage end has responded and processed the key event, if the webpage end has responded and processed the key event, the key event is discarded to stop the key event from continuing flowing to the browser end, the browser end does not respond and process the key event any more, and the specific discarding method is to set an internal member variable m _ defaultHandled of the key event to true to indicate that the key event is processed.
If the webpage end does not respond and process the key event, the key event is continuously sent to the browser end so that the browser end can respond and process the key event, a filtering mechanism is arranged in the browser end, the key event is analyzed and judged layer by layer, if the key event belongs to the event, corresponding processing is carried out, and if the key event does not belong to the event, the key event is continuously transmitted to the next layer. If the key event is passed to the last layer and is not processed, the key event is discarded.
Further, in the second case, the key event flows from the browser end to the web page end, in this case, since the key event is already responded and processed by the browser end once when flowing out from the browser end, when it flows to the web page end, the web page end may respond and process the key event again, which may cause the same key event to be responded and processed by the browser end and the web page end respectively, so that the key event is responded and processed twice, which inevitably causes the above error condition.
Therefore, after the browser obtains the key event sent by the user, because the browser does not know whether the key event has been responded and processed by the web page, or the key event will not be responded and processed by the web page again after the browser responds and processes, the key event may be responded and processed by the web page and the browser at the same time, and the key event is processed twice. Therefore, the scheme provided by the invention is as follows: after the browser end receives the key event, the browser end firstly does not process the key event, but presses the key event into the stack so as to delay the response and the processing of the browser end to the key event, the key event pressed into the stack is firstly sent to the webpage end, and if the webpage end responds and processes the key event pressed into the stack, the key event is directly discarded according to the situation; and if the webpage end does not respond and process the button event pushed to the stack, the button event is pushed out of the stack to be sent to the browser end for the browser end to respond and process.
Furthermore, in order to avoid pressing too many key events into the stack and affecting the response and processing speed of the browser to the key events, after the browser receives the key events of the user, the browser first needs to determine which of the above situations the flow of the key events is. If the key event belongs to the first situation, i.e. the key event flows from the web page to the browser, the key event is directly sent to the web page without being pressed into the stack, so as to execute the first situation. If the key event belongs to the second situation, namely the key event flows into the webpage end from the browser end, the key event is pressed into the stack to delay the response and the processing of the browser end to the key event, the key event pressed into the stack is sent to the webpage end, and then the first situation is executed.
Optionally, an embodiment of the present application provides a method for determining that the webpage end has processed the button event pushed onto the stack, which specifically includes the following steps:
acquiring the state of a focus control and/or the request state of page resources;
and if the state of the focus control and/or the request state of the page resource changes, determining that the key event is processed at the webpage end.
In order to distinguish whether the key event is responded and processed at the webpage end, the method and the device intelligently judge the response processing condition of the key event at the webpage end by monitoring the state of the control for acquiring the focus and the page resource request state.
Specifically, before the key event is transmitted to the web page end, the browser end records control information of the current acquisition focus, and after the key event passes through the web page end, the browser end records the control information of the current acquisition focus again. If the control for acquiring the focus recorded in the two previous and next times is changed, the key event can be considered to be responded and processed by the webpage end.
Specifically, the obtaining, by the browser, control information of the focus before and after the key event processing includes: firstly, the webpage acquires the key event which is transmitted through the inner core of the browser end, so that the browser end can master two time stages before the key event is processed and after the key event is processed. When the browser-side kernel receives a remote controller key event sent by a user, before the key event is about to be sent to the webpage end, the browser-side can acquire information of a current focus control once, then transmit the key event to the webpage for processing, and after the key event flows out of the webpage end, the browser-side acquires information of the current focus control once again. If the focus controls obtained in the two times are changed, the webpage end can be considered to respond and process the key event.
The focus control is changed, that is, the control for acquiring the focus in the page is shifted, for example, two elements are provided in the page, one is < a > and the other is < input >, and when the focus control is moved from < a > to < input >, the focus control is considered to be changed.
On the other hand, after the key event flows into the web page, the browser side monitors the situation of the page for the resource request in real time, and if a request for a new page, a request for a url of a new frame, or the like occurs, it is also considered that the key event is responded and processed by the web page side.
Similar to the method for detecting the focus control state, detecting the page resource request state also detects whether the web page sends a resource request of a new page or a new frame to the browser end in the time period from before the browser end transmits the key event to the web page end to after the web page end flows out. If yes, the key event is considered to be responded and processed by the webpage end.
The detection of the two states is and/or relationship, wherein if one of the states detects that the webpage end processes the key event, the key event can be determined to be processed and responded by the webpage end without being sent to the browser end.
According to the processing method of the key event, whether the key event is processed by the webpage end or not is intelligently judged through the intelligent decision of the key event, and the browser end carries out delayed processing on the key event, so that the processing flow and path of the key event can be automatically distinguished, the problem that the key event in the page cannot be correctly responded is solved, the key event can be perfectly distinguished and distributed, the requirements of IPTV service specifications are met, and the flexibility, intelligence and competitiveness of products are improved.
In the first aspect, a method for processing a key event is provided, and correspondingly, a medium for processing a key event is also provided. Since the media embodiments are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for relevant points. The media embodiments described below are merely illustrative.
A second aspect of the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of: acquiring a key event sent by a user, and pressing the key event into a stack; transmitting the key event pressed into the stack to a webpage end; if the webpage end does not process the key event pressed into the stack, the key event is popped up; sending the popped key event to a browser end; or, if the webpage end processes the key event pressed into the stack, discarding the key event.
In a specific embodiment provided by the present invention, a method for determining that the webpage end has processed the button event pushed to the stack includes the following steps:
acquiring the state of a focus control and/or the request state of page resources;
and if the state of the focus control and/or the request state of the page resource changes, determining that the key event is processed at the webpage end.
In a specific embodiment provided by the present invention, after the step of acquiring the key event sent by the user, the method further includes:
judging whether the key event comes from the webpage end;
if yes, discarding the key event;
and if not, pressing the key event into a stack.
The above is a description of an embodiment of a computer-readable storage medium provided by the second aspect of the present invention.
The computer-readable storage medium and the method for processing the key event provided by the second aspect of the present invention are based on the same inventive concept, and have the same technical effects, which are not described herein again.
In the foregoing first aspect, a method for processing a key event is provided, and correspondingly, a third aspect of the present application further provides a device for processing a key event. Since the apparatus embodiments are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for relevant points. The device embodiments described below are merely illustrative.
The third aspect of the present invention also provides a computer device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the following steps:
acquiring a key event sent by a user, and pressing the key event into a stack;
transmitting the key event pressed into the stack to a webpage end;
if the webpage end does not process the key event pressed into the stack, the key event is popped up;
sending the popped key event to a browser end; or, if the webpage end processes the key event pressed into the stack, discarding the key event.
In a specific embodiment provided by the present invention, the method for determining that the webpage end has processed the button event pushed to the stack includes the following steps:
acquiring the state of a focus control and/or the request state of page resources;
and if the state of the focus control and/or the request state of the page resource changes, determining that the key event is processed at the webpage end.
In a specific embodiment provided by the present invention, after acquiring a key event sent by a user, the method further includes:
judging whether the key event comes from the webpage end;
if yes, discarding the key event;
and if not, pressing the key event into a stack.
The above is a description of an embodiment of a device for processing a key event according to a third aspect of the present invention.
The computer device and the method for processing the key event provided by the third aspect of the present invention are based on the same inventive concept, and have the same technical effects, which are not described herein again.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.

Claims (3)

1. A processing method of key events is applied to a browser end in the IPTV field, and is characterized by comprising the following steps:
acquiring a key event sent by a user;
judging the flow direction of the key event;
if the key event flows from the webpage end to the browser end, the key event is directly sent to the webpage end without being pressed into a stack, if the webpage end processes the key event, the key event is discarded, and if the webpage end does not process the key event, the key event is sent to the browser end;
if the key event flows from the browser end to the web page end, the key event is pressed into a stack to delay the response and processing of the browser end to the key event, which specifically includes:
transmitting the key event pressed into the stack to the webpage end;
judging whether the webpage end processes the button event pressed into the stack or not according to the change of the state of the focus control and/or the request state of the page resource;
if the webpage end processes the key event pressed into the stack, discarding the key event;
if the webpage end does not process the key event pressed into the stack, popping the key event, and sending the popped key event into the browser end;
the step of judging that the webpage end processes the button event pressed into the stack according to the change of the state of the focus control specifically comprises the following steps: before the key event is transmitted to the webpage end, the browser end records first control information of a current acquisition focus, after the key event passes through the webpage end, the browser end records second control information of the current acquisition focus, and if the first control information is different from the second control information, the webpage end is determined to process the key event pressed into the stack;
wherein, judging that the webpage end processes the key event pressed into the stack according to the change of the request state of the page resource specifically comprises: detecting a time period from before the key event is transmitted to the webpage end by the browser end to after the webpage end flows out, and if the webpage end sends a resource request of a new page or a new frame to the browser end, determining that the webpage end processes the key event pressed into the stack.
2. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the key event processing method according to claim 1.
3. A computer device, comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor is configured to read the computer program in the memory and execute the key event processing method of claim 1.
CN201810677760.4A 2018-06-27 2018-06-27 Key event processing method, medium and equipment Active CN108984278B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810677760.4A CN108984278B (en) 2018-06-27 2018-06-27 Key event processing method, medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810677760.4A CN108984278B (en) 2018-06-27 2018-06-27 Key event processing method, medium and equipment

Publications (2)

Publication Number Publication Date
CN108984278A CN108984278A (en) 2018-12-11
CN108984278B true CN108984278B (en) 2021-10-15

Family

ID=64538370

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810677760.4A Active CN108984278B (en) 2018-06-27 2018-06-27 Key event processing method, medium and equipment

Country Status (1)

Country Link
CN (1) CN108984278B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112312179B (en) * 2019-07-23 2024-03-01 青岛海信宽带多媒体技术有限公司 Key response method, equipment and play control terminal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104808920A (en) * 2015-04-30 2015-07-29 青岛海信电器股份有限公司 Focal point control method and focal point control device
CN107105347A (en) * 2017-05-26 2017-08-29 四川长虹电器股份有限公司 With the method for div technological development WEBOS intelligent televisions front end

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9596250B2 (en) * 2009-04-22 2017-03-14 Trusted Knight Corporation System and method for protecting against point of sale malware using memory scraping

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104808920A (en) * 2015-04-30 2015-07-29 青岛海信电器股份有限公司 Focal point control method and focal point control device
CN107105347A (en) * 2017-05-26 2017-08-29 四川长虹电器股份有限公司 With the method for div technological development WEBOS intelligent televisions front end

Also Published As

Publication number Publication date
CN108984278A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
CN112015475B (en) Application program starting method and device
EP2847688B1 (en) A method and system for monitoring and tracking browsing activity on handheld devices
US10762277B2 (en) Optimization schemes for controlling user interfaces through gesture or touch
CN102902580B (en) A kind of program callback method and device
CN106503134A (en) Browser jumps to the method for data synchronization and device of application program
US20130159555A1 (en) Input commands
KR20190000399A (en) Companion application for activity cooperation
CN106775727B (en) Control method and device of mobile terminal
TWI545450B (en) Browser and method for displaying subsites
US20140359408A1 (en) Invoking an Application from a Web Page or other Application
CN107390983A (en) Service order performs method, client and storage medium
CN107391115A (en) A kind of method, apparatus and computer equipment for realizing pop-up alternative events
US20150035775A1 (en) Method and device for operating terminal having touch screen
CN110442819A (en) Data processing method, device, storage medium and terminal
KR20160020486A (en) Independent hit testing for touchpad manipulations and double-tap zooming
KR20140065426A (en) Application program control
US20130201107A1 (en) Simulating Input Types
CN108694009A (en) terminal control method and device
CN109545214A (en) Message distributing method and device based on voice interactive system
CN108984278B (en) Key event processing method, medium and equipment
CN111966273A (en) Information display processing method and device
CN106843559B (en) User instruction identification and processing method and device
US20130179844A1 (en) Input Pointer Delay
CN107102937B (en) User interface testing method and device
CN106598613A (en) Control method and device for mobile terminal

Legal Events

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