jquery - Check touch device using javascript -


I have a small function that determines whether my user is on a touch device that works perfectly ...

function is_touch_device () {return ((in 'octchurch' window) || (navigator.maxtouch points> gt; 0) || (navigator.mmtouch point & gt; 0 )); } If (! Is_touch_device ()) {window.location.href = 'index.html'; }

I would like to add a condition if the device is an iPad, then do not take the redirect again.

I have tried ...

function is_touch_device () {var isiPad = navigator.userAgent.match (/ ipad / i)! = Null; If (! IIPD) {return ((in 'octchurch' window) || (Navigator.maxtouch points> gt; 0) || (Navigator.mms metouach point & gt; 0)); }}; If (! Is_touch_device ()) {window.location.href = 'index.html'; }

But it stops reducing the touch device, in fact all, any thoughts?

There is no need to function and try this script;

  if (/ Android | WebOS | iPhone | iPod | Blackberry | IEobile | Opera Mini / iTest (Navigator user agent)) {Warning ('Mobile device, exclude iPad); } And {warnings ('desktop'); }  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -