A Person
A Person

Reputation: 1350

Events to bind to in mobile devices

I have a simple query:

My web application allows users to use keyboard shortcuts like Ctrl-X etc. to invoke events that require fast input and action e.g Aborting an action that was just carried out quickly.

I am aware of the events to bind to in js for desktops.

However, while I am aware of the tap events and events available for both desktop and mobile browsers (keypress etc.), I would like to ask your opinion on what events could be bound to specifically in mobile browsers, such as muting, volume up/down. The answers I found in Google were archaic and not very cross-browser compliant

So simply put, are there any events, for actions by the user, specifically for browsers on mobile devices that can be bound to, in the event that using click and tap events are too slow or cumbersome?

Upvotes: 0

Views: 301

Answers (2)

mash
mash

Reputation: 15229

As far as I know, the best you can get is the touch events.

Take a look at http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/Introduction/Introduction.html for iOS, not sure if the same documentation exists for android/BB.

It seems odd for a web app to override the default behavior of heavily OS involved physical buttons on the device, like volume/power/home buttons, as the user would experience abnormal behavior which would be confusing to the average user. I doubt it is possible to intercept them in a web app.

EDIT: This specific link has a list of iOS web events you can listen for in a table at the bottom: http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW1

Upvotes: 0

Mike
Mike

Reputation: 11

JQM by itself cannot access the buttons on the phone, if you want to do that you'll have to write additional Java code to access the buttons through the original Android API.

Or, you could use Phonegap: http://docs.phonegap.com/en/2.0.0/cordova_events_events.md.html#Events

Check it out, you can use the "volumeup" or "volumedown" events.

Upvotes: 1

Related Questions