×
Namespaces

Variants
Actions
(Difference between revisions)

Key event handling in S60 Browser 7.1 and S60 WRT 1.1

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:KnowledgeBase) - now using Template:ArticleMetaData)
lpvalente (Talk | contribs)
m (Lpvalente - - Description)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
[[Category:Browser]][[Category:S60 3rd Edition FP2]][[Category:S60 5th Edition]][[Category:JavaScript]][[Category:Symbian Web Runtime]]
__NOEDITSECTION__
+
{{ArticleMetaData <!-- v1.2 -->
{{KBTS}}
+
{{ArticleMetaData
+
|id=TSS001451
+
|platform=S60 3rd Edition FP2, S60 5th Edition
+
|devices=N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
+
|category=Browser, WRT
+
|subcategory=key events
+
|creationdate=June 30, 2009
+
|keywords=Browser, WRT, key events, Web Runtime, key navigation
+
 
+
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|platform= S60 3rd Edition FP2, S60 5th Edition
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Nokia Ron]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= Browser, WRT, key events, Web Runtime, key navigation
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090715
 +
|author= [[User:Nokia Ron]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= key events
 +
|id= TSS001451
 
}}
 
}}
  
[[Category:Browser]][[Category:S60 3rd Edition, Feature Pack 2 ]][[Category:S60 5th Edition]][[Category:JavaScript]][[Category:Symbian Web Runtime]]
+
 
  
 
==Overview==
 
==Overview==
The S60 Browser and WRT (for widgets) have offered developers the ability to capture select and navigation key events using either onKeyPress or onClick, onKeyDown, and onKeyUp events.
+
{{Abstract|The S60 Browser and WRT (for widgets) have offered developers the ability to capture select and navigation key events using either onKeyPress or onClick, onKeyDown, and onKeyUp events.
  
Some early versions of S60 Browser 7.1, however, do not include an implementation for capturing onKeyPress events in either the browser or widgets.  
+
Some early versions of S60 Browser 7.1, however, do not include an implementation for capturing onKeyPress events in either the browser or widgets. }}
  
 
== Description ==
 
== Description ==
Line 34: Line 40:
 
In summary, for 7.1 browsers earlier than version 7.1.15679:
 
In summary, for 7.1 browsers earlier than version 7.1.15679:
 
* '''Centre (Selection key) triggers mouse (onClick) events only, key press events (onKeyPress) are not triggered. '''
 
* '''Centre (Selection key) triggers mouse (onClick) events only, key press events (onKeyPress) are not triggered. '''
* '''Navigation keys (left/right/up/down) trigger key (onKeyDown and onKeyUp) events only, key press events (onKeyPress) are not triggered.'''  
+
* '''Navigation keys (left/right/up/down) trigger key (onKeyDown and onKeyUp) events only, key press events (onKeyPress) are not triggered.'''
  
 
== Solution ==
 
== Solution ==

Latest revision as of 19:47, 9 November 2012

Article Metadata
Tested with
Devices(s): N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
Compatibility
Platform(s): S60 3rd Edition FP2, S60 5th Edition
S60 5th Edition
S60 3rd Edition FP2
Article
Keywords: Browser, WRT, key events, Web Runtime, key navigation
Created: Nokia Ron (15 Jul 2009)
Last edited: lpvalente (09 Nov 2012)


Contents

[edit] Overview

The S60 Browser and WRT (for widgets) have offered developers the ability to capture select and navigation key events using either onKeyPress or onClick, onKeyDown, and onKeyUp events.

Some early versions of S60 Browser 7.1, however, do not include an implementation for capturing onKeyPress events in either the browser or widgets.

[edit] Description

S60 Browser 7.1, for S60 5th Edition and the latest S60 3rd Edition, Feature Pack 2 devices, has undergone a major update. This update involves adopting the WebKit core version 525. This new core introduces changes in the way key events are triggered and delegated to the DOM event handlers.

During the implementation of the new version support for identifying key events with onKeyPress was accidentally omitted. This omission has been addressed in the browser version 7.1.15679 and onKeyPress support will be retained in future versions. However, some devices have already shipped with earlier versions of the browser. This article shows how to create widgets that will work across all browser versions.

In summary, for 7.1 browsers earlier than version 7.1.15679:

  • Centre (Selection key) triggers mouse (onClick) events only, key press events (onKeyPress) are not triggered.
  • Navigation keys (left/right/up/down) trigger key (onKeyDown and onKeyUp) events only, key press events (onKeyPress) are not triggered.

[edit] Solution

Developers wanting to ensure that widget or website JavaScript code works on all versions of the S60 Browser should replace key press events monitoring with monitoring of onKeyDown and onKeyUp events for the left, right, up, and down keys and onClick events for the selection key.

[edit] Code example - handling left/right/up/down key events

Old code

 document.onkeypress = function(event){
// add left/right/up/down keypress event handling code here
}

New code - migrate to this

 document.onkeydown = function(event){
// add left/right/up/down keydown event handling code here
}


Additionally, developers relying on key events from the selection key must migrate to monitoring the click event.

[edit] Code example - handling selection key events

Replace DOMelement with a reference to the DOM element you are monitoring.

Old code

 DOMelement.onkeypress = function(event){
// code for handling selection key events
}

New code - migrate to this

 DOMelement.onclick = function(event){
// add code for handling selection events
}
This page was last modified on 9 November 2012, at 19:47.
128 page views in the last 30 days.
×