Script Events
From MobileDesign
Browsers such as the iPhone Safari, Nokia Series 60 webkit, Opera Mobile, Opera Mini support scripting, usually JavaScript 1.5. But just because scripting is supported does not mean that the script can operate on the document or interact with the browser in expected ways. This page aims to document different browsers' behavior.
If you're just getting started with scripting and mobile web, wander over to the dev.mobi Getting Started with Mobile Ajax. Don't use scripting unless you are also doing device detection.
[edit] Mouse and Key Events
The most obvious variation in behavior is keyboard and mouse events. Can a touch device generate key events? Can a non-touch device generate mouse events? And does it matter to the user? It's been difficult to find the answers to these questions in the various browsers' developer documentation, which is why this page exists.
It looks like devices without keypads, such as the iPhone, simply ignore key events. They aren't triggered. Non-touch devices, on the other hand, typically emulate mouse events. Opera Mini's virtual mouse, for example, triggers all mouse events at the same time as onclick. Even in "mobile" mode, with no mouse at all, devices can potentially use onmouseenter, onclick, and onmouseleave as separate events.
[edit] Client vs. Server
Some transcoding systems such as Openwave's OpenWeb and client-server browsers such as Opera Mini handle script events, but only ones that redraw the entire page. A site such as iGoogle, for example, can add and remove portlets but not move them.
[edit] Browser Details
The table indicates how the user would trigger the event, if relevant.
Help! Need to install reference templates!!! iPhone Handling Events on the iPhone, developer documentation, Apple.
Opera Mini JavaScript support in Opera Mini 4, Chris Mills, 25 Oct 2007.
Opera Mobile Web design with Opera Mobile in mind, Chris Mills, 29 Nov, 2007; Opera Mobile 9.5 the Developer Angle, Chris Mills, 17th Jul 2008.
Pocket IE Internal Pocket IE team blog; extracted events from example code; also see Official MSDN documentation; must look at each element individually.
| DOM Event | iPhone | Opera Mini | Opera Mobile | Nokia S60 webkit | Pocket IE |
|---|---|---|---|---|---|
| scroll | one-finger pan | not supported | virtual mouse support and up/down scroll, depending on mode you are in | ?? | ?? |
| mousemove | finger move and up | not supported | supported | ?? | ?? |
| mouseenter, mouseleave | not supported | part of click | supported | ?? | ?? |
| mousedown, mouseup | on finger up | part of click | supported | ?? | ?? |
| mouseover | with mousemove | part of click | supported | ?? | ?? |
| mouseout | with mousemove | part of click | supported | ?? | ?? |
| mousewheel | 2-finger pan | not supported | supported | ?? | ?? |
| click | finger down & up | part of click | supported | supported | supported |
| blur, focus | supported | not supported | supported | ?? | supported |
| load, unload | supported | supported | supported | supported | supported |
| submit, reset | supported | supported | supported | supported | supported |
| change | supported | supported | supported | ?? | ?? |
| abort | supported | supported | supported | ?? | ?? |
| cut, copy, paste | not supported | not supported | not supported | ?? | ?? |
| selection | not supported | not supported | not supported | ?? | ?? |
| drag, drop | not supported | not supported | not supported | ?? | ?? |
| keydown, keyup | not supported | not supported | not supported | ?? | ?? |
| keypress | not supported | not supported | not supported | ?? | ?? |
| orientationchange | rotate device | not supported | not supported | ?? | ?? |
| interval, delay | not supported | not supported | supported | ?? | ?? |
| contextmenu | not supported | not supported | not supported | ?? | ?? |
| dblclick | not supported | not supported | not supported | ?? | ?? |
| resize | not supported | not supported | supported through zoom | ?? | ?? |
| xmlhttprequest | supported | supported at server only | device dependent, but supported, yes | ?? | supported |
NB: Official documentation of the support for multi-touch events in the mobile Safari browser has been difficult to find but there have been some helpful tutorials written by developers illustrating the use of multi-touch gestures. E.g. http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/

