Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8119 > unrolled thread
| Started by | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| First post | 2011-11-08 13:33 +1100 |
| Last post | 2011-11-08 03:13 -0800 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.javascript
ontouchstart and iOS Andrew Poulos <ap_prog@hotmail.com> - 2011-11-08 13:33 +1100
Re: ontouchstart and iOS Andrew Poulos <ap_prog@hotmail.com> - 2011-11-08 14:22 +1100
Re: ontouchstart and iOS David Mark <dmark.cinsoft@gmail.com> - 2011-11-08 03:26 -0800
Re: ontouchstart and iOS David Mark <dmark.cinsoft@gmail.com> - 2011-11-08 03:13 -0800
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2011-11-08 13:33 +1100 |
| Subject | ontouchstart and iOS |
| Message-ID | <o72dnaRTpINmCSXTnZ2dnUVZ_hKdnZ2d@westnet.com.au> |
I've set this handler window.ontouchstart = myFunc; and it triggers on iOS 5 devices but seems to be ignored on iOS 4 devices. I don't get any errors it just seems to be ignored. Attaching ontouchstart to BODY gets ignored by both iOS 4 and 5. Is there a reliable way to get iOS to recognise ontouchstart anywhere on the page? Andrew Poulos
[toc] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2011-11-08 14:22 +1100 |
| Message-ID | <6cOdnTb2ZYwMPSXTnZ2dnUVZ_o2dnZ2d@westnet.com.au> |
| In reply to | #8119 |
On 8/11/2011 1:33 PM, Andrew Poulos wrote: > I've set this handler > > window.ontouchstart = myFunc; > > and it triggers on iOS 5 devices but seems to be ignored on iOS 4 > devices. I don't get any errors it just seems to be ignored. Attaching > ontouchstart to BODY gets ignored by both iOS 4 and 5. > > Is there a reliable way to get iOS to recognise ontouchstart anywhere on > the page? I'm now testing document.ontouchstart = myFunc; and document.documentElement.ontouchstart = myFunc; and both seem to work. Alas I don't understand why 'window' partly works, 'body' fails, and 'document' works. Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2011-11-08 03:26 -0800 |
| Message-ID | <063a19f9-a44e-48ab-a357-b774e167ba7f@r28g2000yqj.googlegroups.com> |
| In reply to | #8120 |
On Nov 7, 10:22 pm, Andrew Poulos <ap_p...@hotmail.com> wrote: > On 8/11/2011 1:33 PM, Andrew Poulos wrote: > > > I've set this handler > > > window.ontouchstart = myFunc; > > > and it triggers on iOS 5 devices but seems to be ignored on iOS 4 > > devices. I don't get any errors it just seems to be ignored. Attaching > > ontouchstart to BODY gets ignored by both iOS 4 and 5. > > > Is there a reliable way to get iOS to recognise ontouchstart anywhere on > > the page? > > I'm now testing > > document.ontouchstart = myFunc; Unlike with window, I would expect that to work. I don't use document for that either, so can't confirm. > > and > > document.documentElement.ontouchstart = myFunc; Certainly that should work, though you'd think body would as well. > > and both seem to work. Alas I don't understand why 'window' partly > works, 'body' fails, and 'document' works. Can't imagine why body would fail in either version. Could be a bug. You might ask Apple about it. If I were looking into it, I'd set the ontouchstart attribute of the body and look at the ontouchstart property. I assume it will be a function. Also, does setting a global (or window) ontouchstart property change the body (a la onload), perhaps that version of iOS has some wires crossed behind the scenes. If it turns out to be an undetectable bug, the only thing you can do is avoid it (which shouldn't be hard in this case).
[toc] | [prev] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2011-11-08 03:13 -0800 |
| Message-ID | <614fb436-128d-4b2c-a11a-2c564b2d46ac@s5g2000vbe.googlegroups.com> |
| In reply to | #8119 |
On Nov 7, 9:33 pm, Andrew Poulos <ap_p...@hotmail.com> wrote: > I've set this handler > > window.ontouchstart = myFunc; The window object is virtually always the worst bet. There's never been any standard for it. Though the HTML5 recommendation finally mentions it, it hardly matters at this point. > > and it triggers on iOS 5 devices but seems to be ignored on iOS 4 > devices. I don't get any errors it just seems to be ignored. > Attaching > ontouchstart to BODY gets ignored by both iOS 4 and 5. I don't attach touch listeners to the body, but would find it odd if it didn't work like other elements. > > Is there a reliable way to get iOS to recognise ontouchstart anywhere on > the page? Every version on every object? Probably not. If you are going to mess with those events, best to make the feature an optional enhancement.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web