You Are Here:

Community: Wiki

This page was last modified on 22 July 2009, at 09:57.

TSS001451 - Key event handling in S60 Browser 7.1 and S60 WRT 1.1

From Forum Nokia Wiki



ID TSS001451 Creation date June 30, 2009
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


Keywords (APIs, classes, methods, functions): Browser, WRT, key events, Web Runtime, key navigation

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.

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.

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.

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.

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
}

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTSS001451E5fE2dE5fKeyE5feventE5fhandlingE5finE5fS60E5fBrowserE5f7E2e1E5fandE5fS60E5fWE52TE5f1E2e1X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZbrowsingQ qfnZtopicQUqfnTopicZjavascriptQ qfnZtopicQUqfnTopicZwebE5ftechnologyQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ