Open GoogleCodeExporter opened 9 years ago
I'd really love to add Bada compatibility, but I don't have the device to test
to. I'm already buying an avg of 6 devices/year...
Original comment by mat...@gmail.com
on 21 Sep 2010 at 9:17
Add var isBada :-)
I think it's better to use navigator.userAgent instead of appVersion cause in
bada, appVersion only return '5.0'.
isIphone = (/iphone/gi).test(navigator.userAgent),
isIpad = (/ipad/gi).test(navigator.userAgent),
isAndroid = (/android/gi).test(navigator.userAgent),
isBada = (/bada/gi).test(navigator.userAgent),
isTouch = isIphone || isIpad || isAndroid || isBada,
Original comment by jerome.k...@gmail.com
on 21 Sep 2010 at 12:45
I prefere to use appVersion on devices that support it. Actually if the device
supports touches and webkitCSSMatrix we don't care of the device name.
Original comment by mat...@gmail.com
on 21 Sep 2010 at 1:09
You can detect if an event is present without browser sniffing (it avoids
having problems with new browsers).
There is a good article :
http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
You can do somthing like that :
function isEventSupported(eventName) {
var el = document.createElement('div');
eventName = 'on' + eventName;
var isSupported = (eventName in el);
if (!isSupported) {
el.setAttribute(eventName, 'return;');
isSupported = typeof el[eventName] == 'function';
}
el = null;
return isSupported;
}
var isTouch = isEventSupported('touchstart'); // no need to detect browser
Original comment by jerome.k...@gmail.com
on 21 Sep 2010 at 1:56
Unfortunately testing for touch events is not always the best way, that's why
I'm testing for device name, but checking for a serie of supported
functionalities could work.
Original comment by mat...@gmail.com
on 21 Sep 2010 at 2:06
Original issue reported on code.google.com by
jerome.k...@gmail.com
on 21 Sep 2010 at 9:08