Access to native events

The BlackBerry® Browser now supports two new meta tags:

  • cursor-event-mode allows you to define how the browser handles events such as trackpad clicks
  • touch-event-mode allows you to define how the browser handles events such as touch screen gestures

In the past, access to certain user events was not possible from within web content because of a number of usability-related features implemented by the browser. The introduction or the cursor-event-mode and touch-event-mode meta tags allows developers to disable these UI features for a web page, so that browser passes the entire array of events to the web page.

By default, the BlackBerry Browser captures and processes most trackpad clicks or touch events at the UI level to allow for improved usability on small screens. For example, on BlackBerry devices with a trackpad, when the user clicks the track pad on an area of the content that is not a link, the browser zooms into that content block. On devices with a touch screen, users can swipe to scroll, double tap to zoom in to a content block, or touch and hold to display the context menu. In addition, on touch screen devices, most touch events are converted by the browser directly into mouse events; this behavior allows the browser to replicate the way desktop browsers manage user interaction with forms and links, but prevents web content from accessing touch events and gestures as input.

By defining event-handling behavior with the cursor-event-mode and touch-event-mode meta tags, web developers have access to the same interaction model available to Java® developers in the BlackBerry® Java® SDK. For example, web developers can track both the direction and distance of a swipe event, and respond differently based on the swipe direction or distance. Access to these events gives web developers the opportunity to create more dynamic and robust games and applications for the BlackBerry Browser.

Next topic: Web Sockets API
Previous topic: Web Inspector

Was this information helpful? Send us your comments.